3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fib($n, $all=0){ $f[0] = 1; $f[1] = 1; for($i = 2; $i<= $n; $i++) $f[$i] = $f[$i-1]+$f[$i-2]; if($all) return $f; return $f[$n]; } print fib(5000);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yb1ai
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'fib'
          1        SEND_VAL                                                 5000
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function fib:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
Branch analysis from position: 8
filename:       /in/Yb1ai
function name:  fib
number of ops:  23
compiled vars:  !0 = $n, !1 = $all, !2 = $f, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
    4     2        ASSIGN_DIM                                               !2, 0
          3        OP_DATA                                                  1
    5     4        ASSIGN_DIM                                               !2, 1
          5        OP_DATA                                                  1
    6     6        ASSIGN                                                   !3, 2
          7      > JMP                                                      ->16
          8    >   SUB                                              ~8      !3, 1
          9        FETCH_DIM_R                                      ~9      !2, ~8
         10        SUB                                              ~10     !3, 2
         11        FETCH_DIM_R                                      ~11     !2, ~10
         12        ADD                                              ~12     ~9, ~11
         13        ASSIGN_DIM                                               !2, !3
         14        OP_DATA                                                  ~12
         15        PRE_INC                                                  !3
         16    >   IS_SMALLER_OR_EQUAL                                      !3, !0
         17      > JMPNZ                                                    ~14, ->8
    7    18    > > JMPZ                                                     !1, ->20
         19    > > RETURN                                                   !2
    8    20    >   FETCH_DIM_R                                      ~15     !2, !0
         21      > RETURN                                                   ~15
    9    22*     > RETURN                                                   null

End of function fib

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.46 ms | 1390 KiB | 14 Q