3v4l.org

run code in 300+ PHP versions simultaneously
<?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); ?>

preferences:
53.04 ms | 402 KiB | 5 Q