3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generator() { $i=0; echo "Generating value...\r\n"; yield $i; $i++; echo "Incremeting \r\n"; } $x = generator(); for ($i=0;$i<10;$i++) { echo "Getting value"; echo $x(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 5
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 5
Branch analysis from position: 12
Branch analysis from position: 5
filename:       /in/aQmVv
function name:  (null)
number of ops:  13
compiled vars:  !0 = $x, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'generator'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   13     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->10
   14     5    >   ECHO                                                     'Getting+value'
   15     6        INIT_DYNAMIC_CALL                                        !0
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
   13     9        PRE_INC                                                  !1
         10    >   IS_SMALLER                                               !1, 10
         11      > JMPNZ                                                    ~7, ->5
   16    12    > > RETURN                                                   1

Function generator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/aQmVv
function name:  generator
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    5     1        ASSIGN                                                   !0, 0
    6     2        ECHO                                                     'Generating+value...%0D%0A'
    7     3        YIELD                                                    !0
    8     4        PRE_INC                                                  !0
    9     5        ECHO                                                     'Incremeting+%0D%0A'
   10     6      > GENERATOR_RETURN                                         

End of function generator

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.8 ms | 1389 KiB | 14 Q