3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0]; $max = 0; for ($i = 0; $l = ceil(count($arr)) / 2; $i < $l; $i++) { if ($arr[$i] > $max) { $max = $arr[$i]; } } for ($l = count($arr); $i < $l; $i++) { if ($arr[$i] > $max) { $max = $arr[$i]; } } echo "$max in $i iterations";
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected ';', expecting ')' in /in/vonp8 on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected '[' in /in/vonp8 on line 3
Process exited with code 255.

preferences:
181.83 ms | 1386 KiB | 57 Q