3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(0 => 'a', 'str' => 'b'); $b = array('str' => 'b', 0 => 'a'); ksort($a); ksort($b); $c = array(0, 'str'); $d = array('str', 0); sort($c); sort($d); print_r($a); echo "\n"; print_r($b); echo "\n"; print_r($c); echo "\n"; print_r($d);
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => a [str] => b ) Array ( [str] => b [0] => a ) Array ( [0] => 0 [1] => str ) Array ( [0] => str [1] => 0 )
Output for 4.3.0 - 5.6.28
Array ( [str] => b [0] => a ) Array ( [0] => a [str] => b ) Array ( [0] => str [1] => 0 ) Array ( [0] => 0 [1] => str )