3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $foo = array(0,1,2,3,4,40,50,66,72,'f','0','g',4,35,5,654,654,2,2345,456,'asdf'); $bar = array(0,1,2,3,4,40,50,66,72,'f','0','g',4,35,5,654,654,2,2345,456,'asdf'); ksort($foo); ksort($bar, SORT_LOCALE_STRING); var_dump($foo == $bar); var_dump($foo); var_dump($bar);
based on 09iI4
Output for 4.4.0 - 4.4.9, 5.0.2 - 5.6.28, 7.0.0 - 7.1.0
bool(true) array(21) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(40) [6]=> int(50) [7]=> int(66) [8]=> int(72) [9]=> string(1) "f" [10]=> string(1) "0" [11]=> string(1) "g" [12]=> int(4) [13]=> int(35) [14]=> int(5) [15]=> int(654) [16]=> int(654) [17]=> int(2) [18]=> int(2345) [19]=> int(456) [20]=> string(4) "asdf" } array(21) { [0]=> int(0) [1]=> int(1) [10]=> string(1) "0" [11]=> string(1) "g" [12]=> int(4) [13]=> int(35) [14]=> int(5) [15]=> int(654) [16]=> int(654) [17]=> int(2) [18]=> int(2345) [19]=> int(456) [2]=> int(2) [20]=> string(4) "asdf" [3]=> int(3) [4]=> int(4) [5]=> int(40) [6]=> int(50) [7]=> int(66) [8]=> int(72) [9]=> string(1) "f" }
Output for hhvm-3.10.0 - 3.13.2
bool(true) array(21) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(40) [6]=> int(50) [7]=> int(66) [8]=> int(72) [9]=> string(1) "f" [10]=> string(1) "0" [11]=> string(1) "g" [12]=> int(4) [13]=> int(35) [14]=> int(5) [15]=> int(654) [16]=> int(654) [17]=> int(2) [18]=> int(2345) [19]=> int(456) [20]=> string(4) "asdf" } array(21) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(40) [6]=> int(50) [7]=> int(66) [8]=> int(72) [9]=> string(1) "f" [10]=> string(1) "0" [11]=> string(1) "g" [12]=> int(4) [13]=> int(35) [14]=> int(5) [15]=> int(654) [16]=> int(654) [17]=> int(2) [18]=> int(2345) [19]=> int(456) [20]=> string(4) "asdf" }
Output for 4.3.0 - 4.3.11, 5.0.0 - 5.0.1
Notice: Use of undefined constant SORT_LOCALE_STRING - assumed 'SORT_LOCALE_STRING' in /in/MK0i7 on line 5 Warning: ksort() expects parameter 2 to be long, string given in /in/MK0i7 on line 5 bool(true) array(21) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(40) [6]=> int(50) [7]=> int(66) [8]=> int(72) [9]=> string(1) "f" [10]=> string(1) "0" [11]=> string(1) "g" [12]=> int(4) [13]=> int(35) [14]=> int(5) [15]=> int(654) [16]=> int(654) [17]=> int(2) [18]=> int(2345) [19]=> int(456) [20]=> string(4) "asdf" } array(21) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(40) [6]=> int(50) [7]=> int(66) [8]=> int(72) [9]=> string(1) "f" [10]=> string(1) "0" [11]=> string(1) "g" [12]=> int(4) [13]=> int(35) [14]=> int(5) [15]=> int(654) [16]=> int(654) [17]=> int(2) [18]=> int(2345) [19]=> int(456) [20]=> string(4) "asdf" }