3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { yield 11; yield 12; yield 13; } function gen2() { yield from [1, 2, 3]; yield 21; yield 22; yield 23; } $g = gen2(); $c = $g->current(); echo "C: $c\n"; $g->next(); foreach ($g as $val) { echo "$val\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/XdA5R
function name:  (null)
number of ops:  20
compiled vars:  !0 = $g, !1 = $c, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'gen2'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   18     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   19     6        ROPE_INIT                                     3  ~8      'C%3A+'
          7        ROPE_ADD                                      1  ~8      ~8, !1
          8        ROPE_END                                      2  ~7      ~8, '%0A'
          9        ECHO                                                     ~7
   20    10        INIT_METHOD_CALL                                         !0, 'next'
         11        DO_FCALL                                      0          
   22    12      > FE_RESET_R                                       $11     !0, ->18
         13    > > FE_FETCH_R                                               $11, !2, ->18
         14    >   NOP                                                      
         15        FAST_CONCAT                                      ~12     !2, '%0A'
         16        ECHO                                                     ~12
         17      > JMP                                                      ->13
         18    >   FE_FREE                                                  $11
         19      > RETURN                                                   1

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

End of function gen1

Function gen2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/XdA5R
function name:  gen2
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   GENERATOR_CREATE                                         
   10     1        YIELD_FROM                                       ~0      <array>
          2        FREE                                                     ~0
   11     3        YIELD                                                    21
   12     4        YIELD                                                    22
   13     5        YIELD                                                    23
   14     6      > GENERATOR_RETURN                                         

End of function gen2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.84 ms | 1406 KiB | 15 Q