1--TEST-- 2Test natcasesort() function : usage variations - mixed array 3--FILE-- 4<?php 5/* 6 * Pass an array containing sub-arrays, ints, floats, strings, boolean, null 7 * and escape characters to test how natcasesort() re-orders it 8 */ 9 10echo "*** Testing natcasesort() : usage variation ***\n"; 11 12$mixed_values = array ( 13 array(), 14 array( array(33, -5, 6), 15 array(11), 16 array(22, -55), 17 array() 18 ), 19 -4, "4", 4.00, "b", "5", -2, -2.0, -2.98989, "-.9", "True", "", 20 NULL, "ab", "abcd", 0.0, -0, "abcd\x00abcd\x00abcd", '', true, false 21); 22// suppress errors as is generating a lot of "array to string" notices 23var_dump( @natcasesort($mixed_values) ); 24 25var_dump($mixed_values); 26 27echo "Done"; 28?> 29--EXPECTF-- 30*** Testing natcasesort() : usage variation *** 31bool(true) 32array(22) { 33 [12]=> 34 string(0) "" 35 [13]=> 36 NULL 37 [19]=> 38 string(0) "" 39 [21]=> 40 bool(false) 41 [10]=> 42 string(3) "-.9" 43 [7]=> 44 int(-2) 45 [8]=> 46 float(-2) 47 [9]=> 48 float(-2.98989) 49 [2]=> 50 int(-4) 51 [16]=> 52 float(0) 53 [17]=> 54 int(0) 55 [20]=> 56 bool(true) 57 [3]=> 58 string(1) "4" 59 [4]=> 60 float(4) 61 [6]=> 62 string(1) "5" 63 [14]=> 64 string(2) "ab" 65 [15]=> 66 string(4) "abcd" 67 [18]=> 68 string(14) "abcd%0abcd%0abcd" 69 [0]=> 70 array(0) { 71 } 72 [1]=> 73 array(4) { 74 [0]=> 75 array(3) { 76 [0]=> 77 int(33) 78 [1]=> 79 int(-5) 80 [2]=> 81 int(6) 82 } 83 [1]=> 84 array(1) { 85 [0]=> 86 int(11) 87 } 88 [2]=> 89 array(2) { 90 [0]=> 91 int(22) 92 [1]=> 93 int(-55) 94 } 95 [3]=> 96 array(0) { 97 } 98 } 99 [5]=> 100 string(1) "b" 101 [11]=> 102 string(4) "True" 103} 104Done 105