Revert "make hphpc able to use ini files"
[hiphop-php.git] / hphp / test / zend / bad / ext / standard / tests / array / sort_variation2.php
blob1fb2fddde10d2995ffd42a4124cd16267c979cca
1 <?php
2 /* Prototype : bool sort(array &array_arg [, int $sort_flags])
3 * Description: Sort an array
4 * Source code: ext/standard/array.c
5 */
7 /*
8 * Testing sort() by providing different unexpected values for flag argument
9 */
11 echo "*** Testing sort() : usage variations ***\n";
13 //get an unset variable
14 $unset_var = 10;
15 unset ($unset_var);
17 // resource variable
18 $fp = fopen(__FILE__, "r");
20 // temperory array for checking unexpected behavior
21 $unsorted_values = array(10, 2, 45);
23 //array of values to iterate over
24 $unexpected_values = array(
26 // int data
27 /*1*/ -2345,
29 // float data
30 /*2*/ 10.5,
31 -10.5,
32 10.5e2,
33 10.6E-2,
34 .5,
36 // null data
37 /*7*/ NULL,
38 null,
40 // boolean data
41 /*9*/ true,
42 false,
43 TRUE,
44 FALSE,
46 // empty data
47 /*13*/ "",
48 '',
50 // string data
51 /*15*/ "string",
52 'string',
54 // object data
55 /*16*/ new stdclass(),
57 // undefined data
58 /*17*/ @undefined_var,
60 // unset data
61 /*18*/ @unset_var,
63 // resource variable
64 /*19*/ $fp
68 // loop though each element of the array and check the working of sort()
69 // when $flag argument is supplied with different values
70 echo "\n-- Testing sort() by supplying different unexpected values for 'flag' argument --\n";
72 $counter = 1;
73 for($index = 0; $index < count($unexpected_values); $index ++) {
74 echo "-- Iteration $counter --\n";
76 // sort the array, retain a temp. copy of input array for next iteration
77 $value = $unexpected_values [$index];
78 $temp_array = $unsorted_values;
79 var_dump( sort($temp_array, $value) );
81 //dump the sorted array
82 var_dump($temp_array);
83 $counter++;
86 echo "Done";