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
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
14 <<__EntryPoint
>> function main(): void
{
15 echo "*** Testing sort() :usage variations ***\n";
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 var_dump( sort(&$temp_array, SORT_NUMERIC
) ); // expecting : bool(true)
36 var_dump( $temp_array);