3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array(5, "43", 2, "10"); ksort($a); var_dump($a); ksort($a, SORT_NUMERIC); var_dump($a); ksort($a, SORT_STRING); var_dump($a);
based on CCugJ
Output for 4.3.0 - 7.2.0
array(4) { [0]=> int(5) [1]=> string(2) "43" [2]=> int(2) [3]=> string(2) "10" } array(4) { [0]=> int(5) [1]=> string(2) "43" [2]=> int(2) [3]=> string(2) "10" } array(4) { [0]=> int(5) [1]=> string(2) "43" [2]=> int(2) [3]=> string(2) "10" }