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