3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo() { yield 'foo'; goo(); } function too() { yield 'too'; yield from goo(); } function hoo() { yield 'hoo'; yield goo(); } function goo() { yield 'goo'; } foreach(foo() as $a) { print $a.PHP_EOL;} // goo foreach(too() as $a) { print $a.PHP_EOL;} // too goo foreach(hoo() as $a) { print $a.PHP_EOL;} // hoo Uncaught Error: Object of class Generator // could not be converted to string ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 15
Branch analysis from position: 7
filename:       /in/Znbbl
function name:  (null)
number of ops:  25
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                                   'foo'
          1        DO_FCALL                                          0  $1      
          2      > FE_RESET_R                                           $2      $1, ->7
          3    > > FE_FETCH_R                                                   $2, !0, ->7
          4    >   CONCAT                                               ~3      !0, '%0A'
          5        ECHO                                                         ~3
          6      > JMP                                                          ->3
          7    >   FE_FREE                                                      $2
   24     8        INIT_FCALL                                                   'too'
          9        DO_FCALL                                          0  $4      
         10      > FE_RESET_R                                           $5      $4, ->15
         11    > > FE_FETCH_R                                                   $5, !0, ->15
         12    >   CONCAT                                               ~6      !0, '%0A'
         13        ECHO                                                         ~6
         14      > JMP                                                          ->11
         15    >   FE_FREE                                                      $5
   26    16        INIT_FCALL                                                   'hoo'
         17        DO_FCALL                                          0  $7      
         18      > FE_RESET_R                                           $8      $7, ->23
         19    > > FE_FETCH_R                                                   $8, !0, ->23
         20    >   CONCAT                                               ~9      !0, '%0A'
         21        ECHO                                                         ~9
         22      > JMP                                                          ->19
         23    >   FE_FREE                                                      $8
   30    24      > RETURN                                                       1

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

End of function foo

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

End of function too

Function hoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/Znbbl
function name:  hoo
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   GENERATOR_CREATE                                             
   14     1        YIELD                                                        'hoo'
   15     2        INIT_FCALL_BY_NAME                                           'goo'
          3        DO_FCALL                                          0  $1      
          4        YIELD                                                        $1
   16     5      > GENERATOR_RETURN                                             

End of function hoo

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

End of function goo

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
145.23 ms | 1491 KiB | 16 Q