3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(1, 2, 3, 4, 5); $b=Array(); $i = 0; for($i=0;$i<=2;$i++){ switch($i){ case 0: $rand=mt_rand(0,1); $b[$i]=$a[$rand]; break; case 1: if ($rand==0){ $b[]=$a[$rand+1]; else{ $b[]=$a[$rand-1]; } } break; case 2: $b[$i]=$a[2]; break; } } print_r($array); ?>
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected 'else' (T_ELSE) in /in/lbDrC on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_ELSE in /in/lbDrC on line 14
Process exited with code 255.