3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { yield 'a'; yield 'b'; yield 'c'; } $gen1 = foo(); $gen2 = clone $gen1; var_dump(current($gen1)); var_dump(current($gen2)); $gen3 = clone $gen2; var_dump(current($gen3));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h1kt1
function name:  (null)
number of ops:  26
compiled vars:  !0 = $gen1, !1 = $gen2, !2 = $gen3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   10     3        CLONE                                            ~5      !0
          4        ASSIGN                                                   !1, ~5
   11     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'current'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $7      
          9        SEND_VAR                                                 $7
         10        DO_ICALL                                                 
   12    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'current'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $9      
         15        SEND_VAR                                                 $9
         16        DO_ICALL                                                 
   13    17        CLONE                                            ~11     !1
         18        ASSIGN                                                   !2, ~11
   14    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'current'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $13     
         23        SEND_VAR                                                 $13
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

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

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.93 ms | 1399 KiB | 18 Q