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