3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { return 23; yield 1; return 42; } $g = gen1(); var_dump($g->getReturn()); foreach($g as $val) { var_dump($val); } echo "Returning\n"; var_dump($g->getReturn());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/gKb6p
function name:  (null)
number of ops:  22
compiled vars:  !0 = $g, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'gen1'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   10     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getReturn'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   11     8      > FE_RESET_R                                       $6      !0, ->14
          9    > > FE_FETCH_R                                               $6, !1, ->14
   12    10    >   INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   11    13      > JMP                                                      ->9
         14    >   FE_FREE                                                  $6
   14    15        ECHO                                                     'Returning%0A'
   15    16        INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'getReturn'
         18        DO_FCALL                                      0  $8      
         19        SEND_VAR                                                 $8
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

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

End of function gen1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.73 ms | 1399 KiB | 16 Q