3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sumrand($n,$sum) { if ($n== 0) { return $sum; } else { return (sumrand($n-1,$sum+rand(0,1))); } } echo sumrand(500000,0)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kW6st
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'sumrand'
          1        SEND_VAL                                                 500000
          2        SEND_VAL                                                 0
          3        DO_FCALL                                      0  $0      
          4        CONCAT                                           ~1      $0, '%0A'
          5        ECHO                                                     ~1
          6      > RETURN                                                   1

Function sumrand:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kW6st
function name:  sumrand
number of ops:  18
compiled vars:  !0 = $n, !1 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        IS_EQUAL                                                 !0, 0
          3      > JMPZ                                                     ~2, ->6
    5     4    > > RETURN                                                   !1
          5*       JMP                                                      ->17
    8     6    >   INIT_FCALL_BY_NAME                                       'sumrand'
          7        SUB                                              ~3      !0, 1
          8        SEND_VAL_EX                                              ~3
          9        INIT_FCALL                                               'rand'
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 1
         12        DO_ICALL                                         $4      
         13        ADD                                              ~5      !1, $4
         14        SEND_VAL_EX                                              ~5
         15        DO_FCALL                                      0  $6      
         16      > RETURN                                                   $6
   10    17*     > RETURN                                                   null

End of function sumrand

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.78 ms | 1389 KiB | 16 Q