3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function prime($n) { $s = sqrt($n); for ($i = 2; $i <= $s; $i++) { if ($n % $i == 0) { return array_merge(prime($n/$i), array($i)); } } return array($n); } $prime = prime(42); print_r($prime); ?>
Output for 4.3.0 - 7.1.0
Array ( [0] => 7 [1] => 3 [2] => 2 )