3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen() { yield 1; yield 2; yield 3; $array('tom','dick','sally','sue'); foreach ($array as $e) { yield $e; } } $o = gen(); foreach($o as $g) { $g += 10; echo $g, "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) 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/EEZm6
function name:  (null)
number of ops:  11
compiled vars:  !0 = $o, !1 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'gen'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   12     3      > FE_RESET_R                                       $4      !0, ->9
          4    > > FE_FETCH_R                                               $4, !1, ->9
   13     5    >   ASSIGN_OP                                     1          !1, 10
   14     6        ECHO                                                     !1
          7        ECHO                                                     '%0A'
   12     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $4
   15    10      > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 14
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 14
filename:       /in/EEZm6
function name:  gen
number of ops:  16
compiled vars:  !0 = $array, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        YIELD                                                    1
    4     2        YIELD                                                    2
    5     3        YIELD                                                    3
    6     4        INIT_DYNAMIC_CALL                                        !0
          5        SEND_VAL_EX                                              'tom'
          6        SEND_VAL_EX                                              'dick'
          7        SEND_VAL_EX                                              'sally'
          8        SEND_VAL_EX                                              'sue'
          9        DO_FCALL                                      0          
    7    10      > FE_RESET_R                                       $6      !0, ->14
         11    > > FE_FETCH_R                                               $6, !1, ->14
    8    12    >   YIELD                                                    !1
    7    13      > JMP                                                      ->11
         14    >   FE_FREE                                                  $6
   10    15      > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.99 ms | 1399 KiB | 14 Q