3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 4.4.0 - 4.4.9, 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
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 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" }

preferences:
258.04 ms | 404 KiB | 371 Q