1--TEST-- 2Test krsort() function : usage variations - sort bool values 3--FILE-- 4<?php 5/* 6 * testing krsort() by providing array of boolean values for $array argument with following flag values: 7 * 1.flag value as default 8 * 2.SORT_REGULAR - compare items normally 9*/ 10 11echo "*** Testing krsort() : usage variations ***\n"; 12 13// bool value array 14$bool_values = array (true => true, false => false, TRUE => TRUE, FALSE => FALSE); 15 16echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is default --\n"; 17$temp_array = $bool_values; 18var_dump(krsort($temp_array) ); 19var_dump($temp_array); 20 21echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR --\n"; 22$temp_array = $bool_values; 23var_dump(krsort($temp_array, SORT_REGULAR) ); 24var_dump($temp_array); 25 26echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC --\n"; 27$temp_array = $bool_values; 28var_dump(krsort($temp_array, SORT_NUMERIC) ); 29var_dump($temp_array); 30 31echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING --\n"; 32$temp_array = $bool_values; 33var_dump(krsort($temp_array, SORT_STRING) ); 34var_dump($temp_array); 35 36echo "Done\n"; 37?> 38--EXPECT-- 39*** Testing krsort() : usage variations *** 40 41-- Testing krsort() by supplying boolean value array, 'flag' value is default -- 42bool(true) 43array(2) { 44 [1]=> 45 bool(true) 46 [0]=> 47 bool(false) 48} 49 50-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR -- 51bool(true) 52array(2) { 53 [1]=> 54 bool(true) 55 [0]=> 56 bool(false) 57} 58 59-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC -- 60bool(true) 61array(2) { 62 [1]=> 63 bool(true) 64 [0]=> 65 bool(false) 66} 67 68-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING -- 69bool(true) 70array(2) { 71 [1]=> 72 bool(true) 73 [0]=> 74 bool(false) 75} 76Done 77