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.."; } } return ($n == array_sum($factors) / 2) ? true : false; } x(42); ?>
Output for git.master, git.master_jit, rfc.property-hooks
1 is a factor of 42. 2 is a factor of 42. 3 is a factor of 42. 4 is a factor of 42. 5 is a factor of 42. 6 is a factor of 42. 7 is a factor of 42. 8 is a factor of 42. 9 is a factor of 42. 10 is a factor of 42. 11 is a factor of 42. 12 is a factor of 42. 13 is a factor of 42. 14 is a factor of 42. 15 is a factor of 42. 16 is a factor of 42. 17 is a factor of 42. 18 is a factor of 42. 19 is a factor of 42. 20 is a factor of 42. 21 is a factor of 42. 22 is a factor of 42. 23 is a factor of 42. 24 is a factor of 42. 25 is a factor of 42. 26 is a factor of 42. 27 is a factor of 42. 28 is a factor of 42. 29 is a factor of 42. 30 is a factor of 42. 31 is a factor of 42. 32 is a factor of 42. 33 is a factor of 42. 34 is a factor of 42. 35 is a factor of 42. 36 is a factor of 42. 37 is a factor of 42. 38 is a factor of 42. 39 is a factor of 42. 40 is a factor of 42. 41 is a factor of 42. 42 is a factor of 42.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
39.01 ms | 403 KiB | 8 Q