3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x = array('abc', 'ddd', 'bbb', 10, 'www', 0); sort($x); var_dump($x); $x = array('abc', 'ddd', 'bbb', 0, 'www', 10); sort($x); var_dump($x); $x = array('abc', 0, 'aaa', 10); sort($x); var_dump($x); $x = array(0, 'aaa', 10, 5, 'a', 'wat'); sort($x); var_dump($x);
based on qJCfC
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(6) { [0]=> string(3) "abc" [1]=> string(3) "bbb" [2]=> string(3) "ddd" [3]=> string(3) "www" [4]=> int(0) [5]=> int(10) } array(6) { [0]=> string(3) "abc" [1]=> string(3) "bbb" [2]=> string(3) "ddd" [3]=> int(0) [4]=> string(3) "www" [5]=> int(10) } array(4) { [0]=> string(3) "abc" [1]=> int(0) [2]=> string(3) "aaa" [3]=> int(10) } array(6) { [0]=> int(0) [1]=> string(1) "a" [2]=> string(3) "aaa" [3]=> string(3) "wat" [4]=> int(5) [5]=> int(10) }
Output for 4.3.0 - 5.6.28
array(6) { [0]=> int(0) [1]=> string(3) "abc" [2]=> string(3) "bbb" [3]=> string(3) "ddd" [4]=> string(3) "www" [5]=> int(10) } array(6) { [0]=> int(0) [1]=> string(3) "abc" [2]=> string(3) "bbb" [3]=> string(3) "ddd" [4]=> string(3) "www" [5]=> int(10) } array(4) { [0]=> string(3) "aaa" [1]=> int(0) [2]=> string(3) "abc" [3]=> int(10) } array(6) { [0]=> string(1) "a" [1]=> string(3) "wat" [2]=> int(0) [3]=> string(3) "aaa" [4]=> int(5) [5]=> int(10) }