3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo PHP_VERSION; function gen() { (yield 'foo'); var_dump(yield 'bar'); } $gen = gen(); var_dump("OUT".$gen->current()); var_dump("OUT".$gen->current()); var_dump("OUT".$gen->send('something'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3IiAe
function name:  (null)
number of ops:  24
compiled vars:  !0 = $gen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     '8.0.0'
    9     1        INIT_FCALL                                               'gen'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   10     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'current'
          6        DO_FCALL                                      0  $3      
          7        CONCAT                                           ~4      'OUT', $3
          8        SEND_VAL                                                 ~4
          9        DO_ICALL                                                 
   11    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'current'
         12        DO_FCALL                                      0  $6      
         13        CONCAT                                           ~7      'OUT', $6
         14        SEND_VAL                                                 ~7
         15        DO_ICALL                                                 
   12    16        INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'send'
         18        SEND_VAL_EX                                              'something'
         19        DO_FCALL                                      0  $9      
         20        CONCAT                                           ~10     'OUT', $9
         21        SEND_VAL                                                 ~10
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

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

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.43 ms | 1398 KiB | 16 Q