3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getFibonacci() { $i = 0; $k = 1; //first fibonacci value yield $k; while(true) { $k = $i + $k; $i = $k - $i; yield $k; } } $y = 0; foreach(getFibonacci() as $fibonacci) { echo $fibonacci . ","; $y++; if($y > 30) { break; // infinite loop prevent } }
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
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
Branch analysis from position: 12
filename:       /in/7UlWS
function name:  (null)
number of ops:  14
compiled vars:  !0 = $y, !1 = $fibonacci
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, 0
   18     1        INIT_FCALL                                               'getfibonacci'
          2        DO_FCALL                                      0  $3      
          3      > FE_RESET_R                                       $4      $3, ->12
          4    > > FE_FETCH_R                                               $4, !1, ->12
   20     5    >   CONCAT                                           ~5      !1, '%2C'
          6        ECHO                                                     ~5
   21     7        PRE_INC                                                  !0
   22     8        IS_SMALLER                                               30, !0
          9      > JMPZ                                                     ~7, ->11
   24    10    > > JMP                                                      ->12
   18    11    > > JMP                                                      ->4
         12    >   FE_FREE                                                  $4
   26    13      > RETURN                                                   1

Function getfibonacci:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 5
Branch analysis from position: 11
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 5
Branch analysis from position: 11
Branch analysis from position: 5
filename:       /in/7UlWS
function name:  getFibonacci
number of ops:  12
compiled vars:  !0 = $i, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    5     1        ASSIGN                                                   !0, 0
    6     2        ASSIGN                                                   !1, 1
    7     3        YIELD                                                    !1
    8     4      > JMP                                                      ->10
   10     5    >   ADD                                              ~5      !0, !1
          6        ASSIGN                                                   !1, ~5
   11     7        SUB                                              ~7      !1, !0
          8        ASSIGN                                                   !0, ~7
   12     9        YIELD                                                    !1
    8    10    > > JMPNZ                                                    <true>, ->5
   14    11    > > GENERATOR_RETURN                                         

End of function getfibonacci

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.55 ms | 1403 KiB | 14 Q