3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function pfactor(42){ // max_n = 2^31-1 = 2147483647 $d=42; $factors = array(); $dmax = floor(sqrt($n)); $sieve = array(); $sieve = array_fill(1, $dmax,1); do{ $r = false; while ($n%$d==0){ $factors[$d]++; $n/=$d; $r = true; } if ($r){ $dmax = floor(sqrt($n)); } if ($n>1){ for ($i=$d;$i<=$dmax;$i+=$d){ $sieve[$i]=0; } do{ $d++; }while ($sieve[$d]!=1 && $d<$dmax); if ($d>$dmax){ $factors[$n]++; } } }while($n>1 && $d<=$dmax); return $factors; } ?>
Output for 5.4.0 - 5.4.12
Parse error: syntax error, unexpected '42' (T_LNUMBER), expecting '&' or variable (T_VARIABLE) in /in/4HWPW on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.22
Parse error: syntax error, unexpected T_LNUMBER, expecting '&' or T_VARIABLE in /in/4HWPW on line 2
Process exited with code 255.