3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $foo = array( 'a' => 1, 'b' => 0, 'c' => 0, ); asort($foo, SORT_NUMERIC); var_dump($foo); $foo = array( 'a' => 1, 'b' => 0, 'c' => 0, 'd' => 0, ); asort($foo, SORT_NUMERIC); var_dump($foo);
Output for 7.0.0 - 7.1.0
array(3) { ["c"]=> int(0) ["b"]=> int(0) ["a"]=> int(1) } array(4) { ["c"]=> int(0) ["b"]=> int(0) ["d"]=> int(0) ["a"]=> int(1) }
Output for hhvm-3.10.0 - 3.12.0
array(3) { ["b"]=> int(0) ["c"]=> int(0) ["a"]=> int(1) } array(4) { ["b"]=> int(0) ["c"]=> int(0) ["d"]=> int(0) ["a"]=> int(1) }
Output for 4.3.0 - 5.6.28
array(3) { ["c"]=> int(0) ["b"]=> int(0) ["a"]=> int(1) } array(4) { ["d"]=> int(0) ["c"]=> int(0) ["b"]=> int(0) ["a"]=> int(1) }