Revert "make hphpc able to use ini files"
[hiphop-php.git] / hphp / test / zend / bad / ext / standard / tests / array / asort_variation3.php
blob80f6e1e23522502518d129c350a554a5d7d92585
1 <?php
2 /* Prototype : bool asort ( array &$array [, int $sort_flags] )
3 * Description: Sort an array and maintain index association
4 Elements will be arranged from lowest to highest when this function has completed.
5 * Source code: ext/standard/array.c
6 */
8 /*
9 * Testing asort() by providing different integer/float value arrays for $array argument with following values
10 * 1. flag value as defualt
11 * 2. SORT_REGULAR - compare items normally
12 * 3. SORT_NUMERIC - compare items numerically
15 echo "*** Testing asort() : usage variations ***\n";
17 // group of various arrays with indices
18 $various_arrays = array(
19 // negative/posative integer array
20 array(1 => 11, 2 => -11, 3 => 21, 4 => -21, 5 => 31, 6 => -31, 7 => 0, 8 => 41, 10 =>-41),
22 // float value array
23 array(1 => 10.5, 2 => -10.5, 3 => 10.5e2, 4 => 10.6E-2, 5 => .5, 6 => .0001, 7 => -.1),
25 // mixed value array
26 array(1 => .0001, 2 => .0021, 3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, 8 => -.9, 9 => 10.6E-2, 10 => -10.6E-2, 11 => 33),
28 // array values contains minimum and maximum ranges
29 array(1 => 2147483647, 2 => 2147483648, 3 => -2147483647, 4 => -2147483648, 5 => -0, 6 => 0, 7 => -2147483649)
32 // set of possible flag values
33 $flag_value = array("SORT_REGULAR" => SORT_REGULAR, "SORT_NUMERIC" => SORT_NUMERIC);
35 $count = 1;
36 echo "\n-- Testing asort() by supplying various integer/float arrays --\n";
38 // loop through to test asort() with different arrays
39 foreach ($various_arrays as $array) {
40 echo "\n-- Iteration $count --\n";
42 echo "- With default sort_flag -\n";
43 $temp_array = $array;
44 var_dump(asort($temp_array) );
45 var_dump($temp_array);
47 // loop through $flag_value array and setting all possible flag values
48 foreach($flag_value as $key => $flag){
49 echo "- Sort_flag = $key -\n";
50 $temp_array = $array;
51 var_dump(asort($temp_array, $flag) );
52 var_dump($temp_array);
54 $count++;
57 echo "Done\n";