3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen() { $i = 0; $i = &$i; yield $i; var_dump($i); return $i; } $gen = gen(); var_dump($x = $gen->current()); $x++; var_dump($gen->next());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bXJlN
function name:  (null)
number of ops:  16
compiled vars:  !0 = $gen, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'gen'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   15     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'current'
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                           ~5      !1, $4
          7        SEND_VAL                                                 ~5
          8        DO_ICALL                                                 
   16     9        PRE_INC                                                  !1
   18    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'next'
         12        DO_FCALL                                      0  $8      
         13        SEND_VAR                                                 $8
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/bXJlN
function name:  gen
number of ops:  9
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        ASSIGN                                                   !0, 0
    5     2        ASSIGN_REF                                               !0, !0
    7     3        YIELD                                                    !0
    9     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   11     7      > GENERATOR_RETURN                                         
   12     8*     > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.57 ms | 1398 KiB | 16 Q