3v4l.org

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

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

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.8 ms | 1399 KiB | 16 Q