3v4l.org

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

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

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.72 ms | 1399 KiB | 16 Q