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); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dtfKm
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'poisson'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 0
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
   19     5      > RETURN                                                   1

Function poisson:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 5
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 47) Position 1 = 39, Position 2 = 42
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 19
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 47) Position 1 = 39, Position 2 = 42
Branch analysis from position: 39
Branch analysis from position: 42
Branch analysis from position: 42
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 5
Branch analysis from position: 12
Branch analysis from position: 5
filename:       /in/dtfKm
function name:  poisson
number of ops:  45
compiled vars:  !0 = $mu, !1 = $shift, !2 = $x, !3 = $i, !4 = $pcdf, !5 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <array>
    5     3        ASSIGN                                                   !3, 1
          4      > JMP                                                      ->10
    6     5    >   INIT_FCALL                                               'array_push'
          6        SEND_REF                                                 !2
          7        SEND_VAL                                                 0
          8        DO_ICALL                                                 
    5     9        PRE_INC                                                  !3
         10    >   IS_SMALLER_OR_EQUAL                                      !3, !1
         11      > JMPNZ                                                    ~10, ->5
    8    12    >   ASSIGN                                                   !4, 0
    9    13        INIT_FCALL                                               'exp'
         14        MUL                                              ~12     !0, -1
         15        SEND_VAL                                                 ~12
         16        DO_ICALL                                         $13     
         17        ASSIGN                                                   !5, $13
   10    18      > JMP                                                      ->37
   11    19    >   INIT_FCALL                                               'array_push'
         20        SEND_REF                                                 !2
         21        COUNT                                            ~15     !2
         22        SUB                                              ~16     ~15, !1
         23        POW                                              ~17     !0, ~16
         24        MUL                                              ~18     !5, ~17
         25        INIT_FCALL_BY_NAME                                       'facdef'
         26        COUNT                                            ~19     !2
         27        SUB                                              ~20     ~19, !1
         28        SEND_VAL_EX                                              ~20
         29        DO_FCALL                                      0  $21     
         30        DIV                                              ~22     ~18, $21
         31        SEND_VAL                                                 ~22
         32        DO_ICALL                                                 
   12    33        INIT_FCALL                                               'end'
         34        SEND_REF                                                 !2
         35        DO_ICALL                                         $24     
         36        ASSIGN_OP                                     1          !4, $24
   10    37    >   IS_SMALLER                                       ~26     !4, 0.999999
         38      > JMPNZ_EX                                         ~26     ~26, ->42
         39    >   COUNT                                            ~27     !2
         40        IS_SMALLER                                       ~28     ~27, 5
         41        BOOL                                             ~26     ~28
         42    > > JMPNZ                                                    ~26, ->19
   14    43    > > RETURN                                                   !2
   15    44*     > RETURN                                                   null

End of function poisson

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.66 ms | 1407 KiB | 20 Q