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; } else { echo "$factors"; } } return ($n == array_sum($factors) / 2) ? true : false; } perfect(42); ?>
Output for 5.4.0 - 7.1.0
Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array Notice: Array to string conversion in /in/L5JMa on line 12 Array
Output for 4.3.0 - 5.3.29
ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray