3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php print('$a = array(0, "a");' + "\n"); $a = array(0,"a"); sort($a); print('sort($a);'); var_dump($a); sort($a); print('sort($a);'); var_dump($a); sort($a); print('sort($a);'); var_dump($a); sort($a); print('sort($a);'); var_dump($a);
based on nt1kE
Output for 7.1.0 - 7.2.0
Warning: A non-numeric value encountered in /in/8GNVF on line 2 Warning: A non-numeric value encountered in /in/8GNVF on line 2 0sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" } sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" } sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" } sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" }
Output for 7.0.0 - 7.0.20
0sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" } sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" } sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" } sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" }
Output for 5.3.22 - 5.6.28
0sort($a);array(2) { [0]=> string(1) "a" [1]=> int(0) } sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" } sort($a);array(2) { [0]=> string(1) "a" [1]=> int(0) } sort($a);array(2) { [0]=> int(0) [1]=> string(1) "a" }