1--TEST-- 2Test rsort() function : usage variations - boolean values 3--FILE-- 4<?php 5/* Prototype : bool rsort(array &$array_arg [, int $sort_flags]) 6 * Description: Sort an array in reverse order 7 * Source code: ext/standard/array.c 8 */ 9 10/* 11 * Pass rsort() arrays of boolean values to test behaviour 12 */ 13 14echo "*** Testing rsort() : variation ***\n"; 15 16// bool value array 17$bool_values = array (true, false, TRUE, FALSE); 18 19echo "\n-- 'flag' value is defualt --\n"; 20$temp_array = $bool_values; 21var_dump(rsort($temp_array) ); 22var_dump($temp_array); 23 24echo "\n-- 'flag' value is SORT_REGULAR --\n"; 25$temp_array = $bool_values; 26var_dump(rsort($temp_array, SORT_REGULAR) ); 27var_dump($temp_array); 28 29echo "\n-- 'flag' value is SORT_NUMERIC --\n"; 30$temp_array = $bool_values; 31var_dump(rsort($temp_array, SORT_NUMERIC) ); 32var_dump($temp_array); 33 34echo "\n-- 'flag' value is SORT_STRING --\n"; 35$temp_array = $bool_values; 36var_dump(rsort($temp_array, SORT_STRING) ); 37var_dump($temp_array); 38 39echo "Done"; 40?> 41--EXPECTF-- 42*** Testing rsort() : variation *** 43 44-- 'flag' value is defualt -- 45bool(true) 46array(4) { 47 [0]=> 48 bool(true) 49 [1]=> 50 bool(true) 51 [2]=> 52 bool(false) 53 [3]=> 54 bool(false) 55} 56 57-- 'flag' value is SORT_REGULAR -- 58bool(true) 59array(4) { 60 [0]=> 61 bool(true) 62 [1]=> 63 bool(true) 64 [2]=> 65 bool(false) 66 [3]=> 67 bool(false) 68} 69 70-- 'flag' value is SORT_NUMERIC -- 71bool(true) 72array(4) { 73 [0]=> 74 bool(true) 75 [1]=> 76 bool(true) 77 [2]=> 78 bool(false) 79 [3]=> 80 bool(false) 81} 82 83-- 'flag' value is SORT_STRING -- 84bool(true) 85array(4) { 86 [0]=> 87 bool(true) 88 [1]=> 89 bool(true) 90 [2]=> 91 bool(false) 92 [3]=> 93 bool(false) 94} 95Done 96