3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function perfect($n) { if ($n < 1) { return false; } for($i = 1; $i <= $n; $i++) { if ($n % $i == 0) { $factors[] = $i; } } return ($number == array_sum($factors) / 2) ? true : false; } perfect(42); ?>
Output for 5.0.4 - 7.1.0
Notice: Undefined variable: number in /in/art2E on line 11
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: number in /in/art2E on line 11