3v4l.org

run code in 300+ PHP versions simultaneously
<?php function & genRefInner() { $var = 1; yield $var; } function genRefOuter() { return genRefInner(); } foreach(genRefOuter() as &$i) { var_dump($i); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 126) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/ZJLnH
function name:  (null)
number of ops:  11
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'genrefouter'
          1        DO_FCALL                                      0  $1      
          2        SEPARATE                                         $1      $1
          3      > FE_RESET_RW                                      $2      $1, ->9
          4    > > FE_FETCH_RW                                              $2, !0, ->9
   13     5    >   INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   12     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $2
   14    10      > RETURN                                                   1

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

End of function genrefinner

Function genrefouter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZJLnH
function name:  genRefOuter
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'genrefinner'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   10     3*     > RETURN                                                   null

End of function genrefouter

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.28 ms | 1399 KiB | 17 Q