3v4l.org

run code in 500+ PHP versions simultaneously
<?php function &gen() { yield 'foo'; return 'Literal'; } $gen = gen(); var_dump($gen->current()); foreach($gen as $a) { print $a; } print $gen->getReturn(); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/KQ4Nq
function name:  (null)
number of ops:  17
compiled vars:  !0 = $gen, !1 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                                   'gen'
          1        DO_FCALL                                          0  $2      
          2        ASSIGN                                                       !0, $2
   10     3        INIT_FCALL                                                   'var_dump'
          4        INIT_METHOD_CALL                                             !0, 'current'
          5        DO_FCALL                                          0  $4      
          6        SEND_VAR                                                     $4
          7        DO_ICALL                                                     
   13     8      > FE_RESET_R                                           $6      !0, ->12
          9    > > FE_FETCH_R                                                   $6, !1, ->12
   14    10    >   ECHO                                                         !1
   13    11      > JMP                                                          ->9
         12    >   FE_FREE                                                      $6
   17    13        INIT_METHOD_CALL                                             !0, 'getReturn'
         14        DO_FCALL                                          0  $7      
         15        ECHO                                                         $7
   19    16      > RETURN                                                       1

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

End of function gen

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
153.07 ms | 899 KiB | 10 Q