import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-array / sort_variation4.php
blob7739b68b8e0b0e31b616656934a878767425086f
1 <?php
2 /* Prototype : bool sort ( array &$array [, int $sort_flags] )
3 * Description: This function sorts an array.
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 sort() by providing reference variable array with following flag values
10 * flag value as defualt
11 * SORT_REGULAR - compare items normally
12 * SORT_NUMERIC - compare items numerically
15 echo "*** Testing sort() :usage variations ***\n";
17 $value1 = 100;
18 $value2 = 33;
19 $value3 = 555;
21 // an array containing integer references
22 $unsorted_numerics = array( &$value1 , &$value2, &$value3);
24 echo "\n-- Testing sort() by supplying reference variable array, 'flag' value is defualt --\n";
25 $temp_array = $unsorted_numerics;
26 var_dump( sort($temp_array) ); // expecting : bool(true)
27 var_dump( $temp_array);
29 echo "\n-- Testing sort() by supplying reference variable array, 'flag' = SORT_REGULAR --\n";
30 $temp_array = &$unsorted_numerics;
31 var_dump( sort($temp_array, SORT_REGULAR) ); // expecting : bool(true)
32 var_dump( $temp_array);
34 echo "\n-- Testing sort() by supplying reference variable array, 'flag' = SORT_NUMERIC --\n";
35 $temp_array = &$unsorted_numerics;
36 var_dump( sort($temp_array, SORT_NUMERIC) ); // expecting : bool(true)
37 var_dump( $temp_array);
39 echo "Done\n";