3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(1,-1,0,NULL,2,0,-2); $b = array(NULL,-1,0,1,2,-2, 0); $c = array(0,1,-1,0,-2,2,NULL); echo "asort(array(1,-1,0,NULL,2,0,-2))\n"; asort($a, SORT_NUMERIC); print_r($a); echo "\nasort(array(NULL,-1,0,1,2,-2, 0))\n"; asort($b, SORT_NUMERIC); print_r($b); echo "\nasort(array(0,1,-1,0,-2,2,NULL))\n"; asort($c, SORT_NUMERIC); print_r($c);
based on FUH7G
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
asort(array(1,-1,0,NULL,2,0,-2)) Array ( [6] => -2 [1] => -1 [2] => 0 [3] => [5] => 0 [0] => 1 [4] => 2 ) asort(array(NULL,-1,0,1,2,-2, 0)) Array ( [5] => -2 [1] => -1 [0] => [2] => 0 [6] => 0 [3] => 1 [4] => 2 ) asort(array(0,1,-1,0,-2,2,NULL)) Array ( [4] => -2 [2] => -1 [0] => 0 [3] => 0 [6] => [1] => 1 [5] => 2 )
Output for 4.3.0 - 5.6.28
asort(array(1,-1,0,NULL,2,0,-2)) Array ( [6] => -2 [1] => -1 [5] => 0 [3] => [2] => 0 [0] => 1 [4] => 2 ) asort(array(NULL,-1,0,1,2,-2, 0)) Array ( [5] => -2 [1] => -1 [6] => 0 [2] => 0 [0] => [3] => 1 [4] => 2 ) asort(array(0,1,-1,0,-2,2,NULL)) Array ( [4] => -2 [2] => -1 [6] => [3] => 0 [0] => 0 [1] => 1 [5] => 2 )