run code in 200+ 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); ?>

Here you find the average performance (time & memory) of each version. A greyed out version indicates it didn't complete successfully (based on exit-code).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)