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