3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $packed = array(); for ($i = 0; $i < 40; $i++) { $packed[] = 'the number: ' . $i; } $ksort_string = $packed; ksort($ksort_string, (SORT_NATURAL | SORT_FLAG_CASE)); var_dump($ksort_string);
based on sM5ip
Output for 5.4.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
array(40) { [0]=> string(13) "the number: 0" [1]=> string(13) "the number: 1" [2]=> string(13) "the number: 2" [3]=> string(13) "the number: 3" [4]=> string(13) "the number: 4" [5]=> string(13) "the number: 5" [6]=> string(13) "the number: 6" [7]=> string(13) "the number: 7" [8]=> string(13) "the number: 8" [9]=> string(13) "the number: 9" [10]=> string(14) "the number: 10" [11]=> string(14) "the number: 11" [12]=> string(14) "the number: 12" [13]=> string(14) "the number: 13" [14]=> string(14) "the number: 14" [15]=> string(14) "the number: 15" [16]=> string(14) "the number: 16" [17]=> string(14) "the number: 17" [18]=> string(14) "the number: 18" [19]=> string(14) "the number: 19" [20]=> string(14) "the number: 20" [21]=> string(14) "the number: 21" [22]=> string(14) "the number: 22" [23]=> string(14) "the number: 23" [24]=> string(14) "the number: 24" [25]=> string(14) "the number: 25" [26]=> string(14) "the number: 26" [27]=> string(14) "the number: 27" [28]=> string(14) "the number: 28" [29]=> string(14) "the number: 29" [30]=> string(14) "the number: 30" [31]=> string(14) "the number: 31" [32]=> string(14) "the number: 32" [33]=> string(14) "the number: 33" [34]=> string(14) "the number: 34" [35]=> string(14) "the number: 35" [36]=> string(14) "the number: 36" [37]=> string(14) "the number: 37" [38]=> string(14) "the number: 38" [39]=> string(14) "the number: 39" }
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.3.29
Notice: Use of undefined constant SORT_NATURAL - assumed 'SORT_NATURAL' in /in/DIm0e on line 10 Notice: Use of undefined constant SORT_FLAG_CASE - assumed 'SORT_FLAG_CASE' in /in/DIm0e on line 10 Warning: ksort() expects parameter 2 to be long, string given in /in/DIm0e on line 10 array(40) { [0]=> string(13) "the number: 0" [1]=> string(13) "the number: 1" [2]=> string(13) "the number: 2" [3]=> string(13) "the number: 3" [4]=> string(13) "the number: 4" [5]=> string(13) "the number: 5" [6]=> string(13) "the number: 6" [7]=> string(13) "the number: 7" [8]=> string(13) "the number: 8" [9]=> string(13) "the number: 9" [10]=> string(14) "the number: 10" [11]=> string(14) "the number: 11" [12]=> string(14) "the number: 12" [13]=> string(14) "the number: 13" [14]=> string(14) "the number: 14" [15]=> string(14) "the number: 15" [16]=> string(14) "the number: 16" [17]=> string(14) "the number: 17" [18]=> string(14) "the number: 18" [19]=> string(14) "the number: 19" [20]=> string(14) "the number: 20" [21]=> string(14) "the number: 21" [22]=> string(14) "the number: 22" [23]=> string(14) "the number: 23" [24]=> string(14) "the number: 24" [25]=> string(14) "the number: 25" [26]=> string(14) "the number: 26" [27]=> string(14) "the number: 27" [28]=> string(14) "the number: 28" [29]=> string(14) "the number: 29" [30]=> string(14) "the number: 30" [31]=> string(14) "the number: 31" [32]=> string(14) "the number: 32" [33]=> string(14) "the number: 33" [34]=> string(14) "the number: 34" [35]=> string(14) "the number: 35" [36]=> string(14) "the number: 36" [37]=> string(14) "the number: 37" [38]=> string(14) "the number: 38" [39]=> string(14) "the number: 39" }