3v4l.org

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

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

End of function gen_stuff

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.88 ms | 1399 KiB | 16 Q