3v4l.org

run code in 300+ PHP versions simultaneously
<?php function x($n) { for($i = 1; $i <= $n; $i++) { if ($n % $i == 0 && $i != $n) { $factors[] = $i; echo "$i is a factor of $n." . PHP_EOL; } elseif ($i == $n) { echo "Removing $n from array.." . PHP_EOL; } } if ($n == array_sum($a) / 2) { echo "It's perfect!" . PHP_EOL; } elseif { echo "It's not perfect!" . PHP_EOL; } } x(42); ?>
Output for 5.3.0 - 5.3.22, 5.4.0 - 5.4.12
Parse error: syntax error, unexpected '{', expecting '(' in 9W2Bf on line 15
Process exited with code 255.

preferences:
173.09 ms | 1399 KiB | 43 Q