3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen($a) { yield $a; yield $a + 1; } function yf() { yield from gen(1); yield from gen(10); } $g = yf(); var_dump($g->current());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QNA76
function name:  (null)
number of ops:  9
compiled vars:  !0 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'yf'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   14     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'current'
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

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

End of function gen

Function yf:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/QNA76
function name:  yf
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   GENERATOR_CREATE                                         
    9     1        INIT_FCALL                                               'gen'
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0  $0      
          4        YIELD_FROM                                       ~1      $0
          5        FREE                                                     ~1
   10     6        INIT_FCALL                                               'gen'
          7        SEND_VAL                                                 10
          8        DO_FCALL                                      0  $2      
          9        YIELD_FROM                                       ~3      $2
         10        FREE                                                     ~3
   11    11      > GENERATOR_RETURN                                         

End of function yf

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.81 ms | 1399 KiB | 18 Q