3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function perfect($n) { if ($n < 1) { echo "Number has to be Positive."; return false; } for($i = 1; $i <= $n; $i++) { if ($n % $i == 0) { $factors[] = $i; } } return ($n == array_sum($factors) / 2) ? true : false; echo "$n $factors [$i]" } perfect(42); ?>
Output for 5.3.0 - 5.4.12
Parse error: syntax error, unexpected '}', expecting ',' or ';' in /in/4iuHf on line 14
Process exited with code 255.