3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bar($x) { yield from $x; } /* Twice a Generator from bar() using yield from on $gen */ $it = [1, 2, 3, 4]; $gens[] = bar($it); $gens[] = bar($it); $i = 0; do { foreach ($gens as $g) { var_dump($g->current()); $g->next(); } $i++; } while($gens[0]->valid()); var_dump($gens[1]->valid());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 12
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 22
filename:       /in/7g6Bm
function name:  (null)
number of ops:  35
compiled vars:  !0 = $it, !1 = $gens, !2 = $i, !3 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL                                               'bar'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $6      
          4        ASSIGN_DIM                                               !1
          5        OP_DATA                                                  $6
   10     6        INIT_FCALL                                               'bar'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $8      
          9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  $8
   11    11        ASSIGN                                                   !2, 0
   13    12    > > FE_RESET_R                                       $10     !1, ->22
         13    > > FE_FETCH_R                                               $10, !3, ->22
   14    14    >   INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !3, 'current'
         16        DO_FCALL                                      0  $11     
         17        SEND_VAR                                                 $11
         18        DO_ICALL                                                 
   15    19        INIT_METHOD_CALL                                         !3, 'next'
         20        DO_FCALL                                      0          
   13    21      > JMP                                                      ->13
         22    >   FE_FREE                                                  $10
   17    23        PRE_INC                                                  !2
   18    24        FETCH_DIM_R                                      ~15     !1, 0
         25        INIT_METHOD_CALL                                         ~15, 'valid'
         26        DO_FCALL                                      0  $16     
         27      > JMPNZ                                                    $16, ->12
   19    28    >   INIT_FCALL                                               'var_dump'
         29        FETCH_DIM_R                                      ~17     !1, 1
         30        INIT_METHOD_CALL                                         ~17, 'valid'
         31        DO_FCALL                                      0  $18     
         32        SEND_VAR                                                 $18
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/7g6Bm
function name:  bar
number of ops:  5
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    4     2        YIELD_FROM                                       ~1      !0
          3        FREE                                                     ~1
    5     4      > GENERATOR_RETURN                                         

End of function bar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.55 ms | 1407 KiB | 17 Q