3v4l.org

run code in 300+ PHP versions simultaneously
<?php function TestIterator(){ $tab = [1,2,3,4,5,6]; for($i = 0; $i < count($tab); $i++){ yield $tab[$i]; } } $r = TestIterator(); var_dump($r[0]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVo7K
function name:  (null)
number of ops:  8
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'testiterator'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
    9     3        INIT_FCALL                                               'var_dump'
          4        FETCH_DIM_R                                      ~3      !0, 0
          5        SEND_VAL                                                 ~3
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function testiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
Branch analysis from position: 4
filename:       /in/MVo7K
function name:  TestIterator
number of ops:  11
compiled vars:  !0 = $tab, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        ASSIGN                                                   !0, <array>
    4     2        ASSIGN                                                   !1, 0
          3      > JMP                                                      ->7
    5     4    >   FETCH_DIM_R                                      ~4      !0, !1
          5        YIELD                                                    ~4
    4     6        PRE_INC                                                  !1
          7    >   COUNT                                            ~7      !0
          8        IS_SMALLER                                               !1, ~7
          9      > JMPNZ                                                    ~8, ->4
    7    10    > > GENERATOR_RETURN                                         

End of function testiterator

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.35 ms | 1398 KiB | 16 Q