1--TEST-- 2Test rsort() function : usage variations - referenced variables 3--INI-- 4allow_call_time_pass_reference=on 5--FILE-- 6<?php 7/* Prototype : bool rsort(array &$array_arg [, int $sort_flags]) 8 * Description: Sort an array in reverse order 9 * Source code: ext/standard/array.c 10 */ 11 12/* 13 * Test behaviour of rsort() when: 14 * 1. passed an array of referenced variables 15 * 2. $array_arg is a reference to another array 16 * 3. $array_arg is passed by reference 17 */ 18 19echo "*** Testing rsort() : variation ***\n"; 20 21$value1 = 100; 22$value2 = 33; 23$value3 = 555; 24 25// an array containing integer references 26$unsorted_numerics = array( &$value1 , &$value2, &$value3); 27 28echo "\n-- 'flag' value is defualt --\n"; 29$temp_array = $unsorted_numerics; 30var_dump( rsort($temp_array) ); 31var_dump( $temp_array); 32 33echo "\n-- 'flag' = SORT_REGULAR --\n"; 34$temp_array = &$unsorted_numerics; 35var_dump( rsort($temp_array, SORT_REGULAR) ); 36var_dump( $temp_array); 37 38echo "\n-- 'flag' = SORT_NUMERIC --\n"; 39$temp_array = $unsorted_numerics; 40var_dump( rsort(&$temp_array, SORT_NUMERIC) ); 41var_dump( $temp_array); 42 43echo "Done"; 44?> 45--EXPECTF-- 46*** Testing rsort() : variation *** 47 48-- 'flag' value is defualt -- 49bool(true) 50array(3) { 51 [0]=> 52 &int(555) 53 [1]=> 54 &int(100) 55 [2]=> 56 &int(33) 57} 58 59-- 'flag' = SORT_REGULAR -- 60bool(true) 61array(3) { 62 [0]=> 63 &int(555) 64 [1]=> 65 &int(100) 66 [2]=> 67 &int(33) 68} 69 70-- 'flag' = SORT_NUMERIC -- 71bool(true) 72array(3) { 73 [0]=> 74 &int(555) 75 [1]=> 76 &int(100) 77 [2]=> 78 &int(33) 79} 80Done 81