3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array('a' => 2, 'b' => 1, 'c' => 4); krsort($array); print_r($array); $array = array('q' => 2, 'b' => 1, 'z' => 4); $array = array_reverse($array); print_r($array); $array = array('a' => 2, 'b' => 1, 'c' => 4); $first = array_shift($array); array_unshift(array_pop($array)); array_push($array,$first); print_r($array);
Output for 7.0.0 - 7.1.0
Array ( [c] => 4 [b] => 1 [a] => 2 ) Array ( [z] => 4 [b] => 1 [q] => 2 ) Notice: Only variables should be passed by reference in /in/mtKT3 on line 12 Warning: array_unshift() expects at least 2 parameters, 1 given in /in/mtKT3 on line 12 Array ( [b] => 1 [0] => 2 )
Output for hhvm-3.10.0 - 3.12.0
Array ( [c] => 4 [b] => 1 [a] => 2 ) Array ( [z] => 4 [b] => 1 [q] => 2 ) Warning: array_unshift() expects exactly 2 parameters, 1 given in /in/mtKT3 on line 12 Array ( [b] => 1 [0] => 2 )
Output for 5.3.0 - 5.6.28
Array ( [c] => 4 [b] => 1 [a] => 2 ) Array ( [z] => 4 [b] => 1 [q] => 2 ) Strict Standards: Only variables should be passed by reference in /in/mtKT3 on line 12 Warning: array_unshift() expects at least 2 parameters, 1 given in /in/mtKT3 on line 12 Array ( [b] => 1 [0] => 2 )
Output for 5.1.0 - 5.2.17
Array ( [c] => 4 [b] => 1 [a] => 2 ) Array ( [z] => 4 [b] => 1 [q] => 2 ) Strict Standards: Only variables should be passed by reference in /in/mtKT3 on line 12 Warning: Wrong parameter count for array_unshift() in /in/mtKT3 on line 12 Array ( [b] => 1 [0] => 2 )
Output for 5.0.5
Array ( [c] => 4 [b] => 1 [a] => 2 ) Array ( [z] => 4 [b] => 1 [q] => 2 ) Fatal error: Only variables can be passed by reference in /in/mtKT3 on line 12
Process exited with code 255.
Output for 4.3.2 - 5.0.4
Array ( [c] => 4 [b] => 1 [a] => 2 ) Array ( [z] => 4 [b] => 1 [q] => 2 ) Warning: Wrong parameter count for array_unshift() in /in/mtKT3 on line 12 Array ( [b] => 1 [0] => 2 )
Output for 4.3.0 - 4.3.1
Array ( [c] => 4 [b] => 1 [a] => 2 ) Array ( [z] => 4 [b] => 1 [q] => 2 ) Warning: Wrong parameter count for array_unshift() in /in/mtKT3 on line 12 Array ( [b] => 1 [1] => 2 )