3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php # I expected sort() not to be stable on same values, but this? # Using SORT_NUMERIC "fixes" it? $a=array(0,"a"); var_dump($a); sort($a); var_dump($a); sort($a); var_dump($a);
Output for 7.0.0 - 7.2.0
array(2) { [0]=> int(0) [1]=> string(1) "a" } array(2) { [0]=> int(0) [1]=> string(1) "a" } array(2) { [0]=> int(0) [1]=> string(1) "a" }
Output for 5.3.22 - 5.6.28
array(2) { [0]=> int(0) [1]=> string(1) "a" } array(2) { [0]=> string(1) "a" [1]=> int(0) } array(2) { [0]=> int(0) [1]=> string(1) "a" }