3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fib($num) { if ($num === 1) { return 1; } elseif ($num === 2) { return 1; } return fib($num-2) + fib($num-1); } for($i = 1; $i < 20; ++$i) { print(fib($i) . "\n"); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 2
Branch analysis from position: 10
Branch analysis from position: 2
filename:       /in/odcDQ
function name:  (null)
number of ops:  11
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, 1
          1      > JMP                                                      ->8
   14     2    >   INIT_FCALL                                               'fib'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        CONCAT                                           ~3      $2, '%0A'
          6        ECHO                                                     ~3
   13     7        PRE_INC                                                  !0
          8    >   IS_SMALLER                                               !0, 20
          9      > JMPNZ                                                    ~5, ->2
   15    10    > > RETURN                                                   1

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

End of function fib

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
190.41 ms | 1399 KiB | 14 Q