3v4l.org

run code in 200+ 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'); $quux = array('a' => 1, 'aaa' => 2, 'aa' => 3); ksort($foo); ksort($quux, SORT_LOCALE_STRING); ksort($bar, SORT_LOCALE_STRING); var_dump($quux); var_dump($foo == $bar);
based on Iv0Rg
Output for 4.4.0 - 4.4.9, 5.0.2 - 7.2.0
array(3) { ["a"]=> int(1) ["aa"]=> int(3) ["aaa"]=> int(2) } bool(true)
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/tFHbX on line 6 Warning: ksort() expects parameter 2 to be long, string given in /in/tFHbX on line 6 Notice: Use of undefined constant SORT_LOCALE_STRING - assumed 'SORT_LOCALE_STRING' in /in/tFHbX on line 7 Warning: ksort() expects parameter 2 to be long, string given in /in/tFHbX on line 7 array(3) { ["a"]=> int(1) ["aaa"]=> int(2) ["aa"]=> int(3) } bool(true)