3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { yield 1; yield 2; } function bar($foo) { yield from $foo; yield 3; } $foo = foo(); $bar = bar($foo); $bar->next(); $foo->next(); foreach ($bar as $v) { var_dump($v); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/LpeXK
function name:  (null)
number of ops:  19
compiled vars:  !0 = $foo, !1 = $bar, !2 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   17     3        INIT_FCALL                                               'bar'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !1, $5
   18     7        INIT_METHOD_CALL                                         !1, 'next'
          8        DO_FCALL                                      0          
   19     9        INIT_METHOD_CALL                                         !0, 'next'
         10        DO_FCALL                                      0          
   20    11      > FE_RESET_R                                       $9      !1, ->17
         12    > > FE_FETCH_R                                               $9, !2, ->17
   21    13    >   INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   20    16      > JMP                                                      ->12
         17    >   FE_FREE                                                  $9
   22    18      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/LpeXK
function name:  foo
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    5     1        YIELD                                                    1
    6     2        YIELD                                                    2
    7     3      > GENERATOR_RETURN                                         

End of function foo

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

End of function bar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.63 ms | 1403 KiB | 17 Q