3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &gen_reference() { $data = [77,78,79]; foreach($data as $value ) { yield $value; } } foreach (gen_reference() as &$number) { echo $number *= -1,"\n"; } // Must unset $number ... foreach(gen_reference() as $number){ echo $number; }
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
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 9
filename:       /in/5Amo4
function name:  (null)
number of ops:  18
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'gen_reference'
          1        DO_FCALL                                      0  $1      
          2        SEPARATE                                         $1      $1
          3      > FE_RESET_RW                                      $2      $1, ->9
          4    > > FE_FETCH_RW                                              $2, !0, ->9
   11     5    >   ASSIGN_OP                                     3  ~3      !0, -1
          6        ECHO                                                     ~3
          7        ECHO                                                     '%0A'
   10     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $2
   14    10        INIT_FCALL                                               'gen_reference'
         11        DO_FCALL                                      0  $4      
         12      > FE_RESET_R                                       $5      $4, ->16
         13    > > FE_FETCH_R                                               $5, !0, ->16
   15    14    >   ECHO                                                     !0
   14    15      > JMP                                                      ->13
         16    >   FE_FREE                                                  $5
   16    17      > RETURN                                                   1

Function gen_reference:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 6
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 6
filename:       /in/5Amo4
function name:  gen_reference
number of ops:  8
compiled vars:  !0 = $data, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        ASSIGN                                                   !0, <array>
    5     2      > FE_RESET_R                                       $3      !0, ->6
          3    > > FE_FETCH_R                                               $3, !1, ->6
    6     4    >   YIELD                                                    !1
    5     5      > JMP                                                      ->3
          6    >   FE_FREE                                                  $3
    8     7      > GENERATOR_RETURN                                         

End of function gen_reference

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.22 ms | 1399 KiB | 15 Q