3v4l.org

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

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/ssgpF
function name:  foo
number of ops:  9
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        ASSIGN                                                   !0, <array>
    5     2        YIELD                                                    !0
    6     3        ECHO                                                     'Gen%3A+'
          4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
    7     7        YIELD                                                    'done'
    8     8      > GENERATOR_RETURN                                         

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.92 ms | 1398 KiB | 16 Q