3v4l.org

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

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

End of function sum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.98 ms | 1398 KiB | 14 Q