3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x = array(-3,5,1,3,2,10); function array_rev($array) { for ($i = 0; $i <= count($array)/2 - 1; $i++) { $holder = $array[$i]; $array[$i] = $array[count($array) - ($i + 1)]; echo " "; echo $array[$i]; echo " "; $array[count($array) - ($i + 1)] = $holder; echo $array[count($array) - ($i + 1)]; } print_r($array); } array_rev($x);
based on 314n5
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
10 -3 2 5 3 1Array ( [0] => 10 [1] => 2 [2] => 3 [3] => 1 [4] => 5 [5] => -3 )