3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen() { echo "yielding\n"; yield 24; echo "returning\n"; return 42; } $g = gen(); $g->next(); var_dump($g->valid()); var_dump($g->current()); $g->next(); var_dump($g->valid()); var_dump($g->current()); var_dump($g->getReturn());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EYlTD
function name:  (null)
number of ops:  33
compiled vars:  !0 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'gen'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   11     3        INIT_METHOD_CALL                                         !0, 'next'
          4        DO_FCALL                                      0          
   12     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'valid'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
   13    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'current'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
   14    15        INIT_METHOD_CALL                                         !0, 'next'
         16        DO_FCALL                                      0          
   15    17        INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !0, 'valid'
         19        DO_FCALL                                      0  $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                                 
   16    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !0, 'current'
         24        DO_FCALL                                      0  $11     
         25        SEND_VAR                                                 $11
         26        DO_ICALL                                                 
   17    27        INIT_FCALL                                               'var_dump'
         28        INIT_METHOD_CALL                                         !0, 'getReturn'
         29        DO_FCALL                                      0  $13     
         30        SEND_VAR                                                 $13
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

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

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.74 ms | 1399 KiB | 16 Q