3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fibonacci($n) { $arr = array(); $a = 0; $b = 1; while($n-- > 0) { array_push($arr, $a); $a = $b - $a; $b = $a + $b; } return $arr; } foreach(fibonacci(5) as $n => $i) { echo "$n: $i\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/qrIId
function name:  (null)
number of ops:  14
compiled vars:  !0 = $i, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'fibonacci'
          1        SEND_VAL                                                 5
          2        DO_FCALL                                      0  $2      
          3      > FE_RESET_R                                       $3      $2, ->12
          4    > > FE_FETCH_R                                       ~4      $3, !0, ->12
          5    >   ASSIGN                                                   !1, ~4
   17     6        ROPE_INIT                                     4  ~7      !1
          7        ROPE_ADD                                      1  ~7      ~7, '%3A+'
          8        ROPE_ADD                                      2  ~7      ~7, !0
          9        ROPE_END                                      3  ~6      ~7, '%0A'
         10        ECHO                                                     ~6
   16    11      > JMP                                                      ->4
         12    >   FE_FREE                                                  $3
   18    13      > RETURN                                                   1

Function fibonacci:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
Branch analysis from position: 5
filename:       /in/qrIId
function name:  fibonacci
number of ops:  18
compiled vars:  !0 = $n, !1 = $arr, !2 = $a, !3 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, 0
    7     3        ASSIGN                                                   !3, 1
    8     4      > JMP                                                      ->13
    9     5    >   INIT_FCALL                                               'array_push'
          6        SEND_REF                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                                 
   10     9        SUB                                              ~8      !3, !2
         10        ASSIGN                                                   !2, ~8
   11    11        ADD                                              ~10     !2, !3
         12        ASSIGN                                                   !3, ~10
    8    13    >   POST_DEC                                         ~12     !0
         14        IS_SMALLER                                               0, ~12
         15      > JMPNZ                                                    ~13, ->5
   13    16    > > RETURN                                                   !1
   14    17*     > RETURN                                                   null

End of function fibonacci

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.98 ms | 1403 KiB | 16 Q