3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /* for each month i 6monthAvg = round( ( ( $profits[$i] +((isset($profits[$i-1])) ? $profits[$i-1] : 0) +((isset($profits[$i-2])) ? $profits[$i-2] : 0) +((isset($profits[$i-3])) ? $profits[$i-3] : 0) +((isset($profits[$i-4])) ? $profits[$i-4] : 0) +((isset($profits[$i-5])) ? $profits[$i-5] : 0))/6),2); for($i = 5, $length = count($months); $i < $length; $i++) { echo round(array_sum(array_slice($months, $i, -6), 2); } foreach(array_chunk($months, 6) as $sixMonths){ if(count($sixMonths) == 6) echo round(array_sum($sixMonths), 2); else echo "Not 6 months avilable"; } */ print_r(array_slice([1,2,3,4,5,6], 5, -6));
Output for 5.4.10 - 7.2.0
Array ( )
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/NAude on line 28
Process exited with code 255.