3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generator() { yield 'First value'; for ($i = 1; $i <= 3; $i++) { yield $i; } } $gen = generator(); echo $gen->current(); echo $gen->next(); foreach ($gen as $value) { echo $value . '<br/>'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/0AcJ5
function name:  (null)
number of ops:  16
compiled vars:  !0 = $gen, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'generator'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   11     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
   12     6        INIT_METHOD_CALL                                         !0, 'next'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
   14     9      > FE_RESET_R                                       $6      !0, ->14
         10    > > FE_FETCH_R                                               $6, !1, ->14
   15    11    >   CONCAT                                           ~7      !1, '%3Cbr%2F%3E'
         12        ECHO                                                     ~7
   14    13      > JMP                                                      ->10
         14    >   FE_FREE                                                  $6
   16    15      > RETURN                                                   1

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

End of function generator

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.58 ms | 1398 KiB | 14 Q