import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-array / shuffle_variation1.php
blob5c325b706ebc0b75a271846482230c4c683fe32c
1 <?php
2 /* Prototype : bool shuffle(array $array_arg)
3 * Description: Randomly shuffle the contents of an array
4 * Source code: ext/standard/array.c
5 */
7 /*
8 * Test behaviour of shuffle() when unexpected values are passed for 'array_arg'
9 * argument and verify that function outputs required warning messages wherever applicable
12 echo "*** Testing shuffle() : with unexpected values for 'array_arg' argument ***\n";
15 //get an unset variable
16 $unset_var = 10;
17 unset ($unset_var);
19 //get a resource variable
20 $fp = fopen(__FILE__, "r");
22 //define a class
23 class test
25 var $t = 10;
26 function __toString()
28 return "object";
32 //array of values to iterate over
33 $values = array(
35 // int data
36 /*1*/ 0,
38 12345,
39 -2345,
41 // float data
42 /*5*/ 10.5,
43 -10.5,
44 12.3456789000e10,
45 12.3456789000E-10,
46 .5,
48 // null data
49 /*10*/ NULL,
50 null,
52 // boolean data
53 /*12*/ true,
54 false,
55 TRUE,
56 FALSE,
58 // empty data
59 /*16*/ "",
60 '',
62 // string data
63 /*18*/ "string",
64 'string',
66 // object data
67 /*20*/ new test(),
69 // undefined data
70 /*21*/ @$undefined_var,
72 // unset data
73 /*22*/ @$unset_var,
75 /*23*/ // resource data
76 $fp
79 // loop through the array to test shuffle() function
80 // with each element of the array
81 $count = 1;
82 foreach($values as $value) {
83 echo "\n-- Iteration $count --\n";
84 var_dump( shuffle($value) );
85 $count++;
88 // closing the resource
89 fclose($fp);
91 echo "Done";