3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function poisson($mu,$shift) { #returns array of poisson probabilities for scores $x = []; for ($i = 1 ; $i <= $shift ; $i++ ) { array_push($x,0.0); } $pcdf = 0.0; $a = exp(-1*$mu); while ( $pcdf < 0.999999 || count($x) < 5 ) { array_push($x,$a*($mu**(count($x)-$shift))/facdef(count($x)-$shift)); $pcdf+=end($x); } return $x; } echo poisson(1,0); ?>
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function facdef() in /in/dtfKm:11 Stack trace: #0 /in/dtfKm(17): poisson(1, 0) #1 {main} thrown in /in/dtfKm on line 11
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Fatal error: Call to undefined function facdef() in /in/dtfKm on line 11
Process exited with code 255.
Output for 5.4.10 - 5.5.35
Parse error: syntax error, unexpected '*' in /in/dtfKm on line 11
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/dtfKm on line 4
Process exited with code 255.