3v4l.org

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

Function generator:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 126) 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
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 7
filename:       /in/ZL84S
function name:  generator
number of ops:  9
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    6     2      > FE_RESET_RW                                      $3      !0, ->7
          3    > > FE_FETCH_RW                                      ~4      $3, !1, ->7
          4    >   ASSIGN                                                   !2, ~4
    7     5        YIELD                                                    !1, !2
    6     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $3
    9     8      > GENERATOR_RETURN                                         

End of function generator

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.68 ms | 1399 KiB | 18 Q