3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen($gen) { $id = yield $gen->id; } $gen = new stdClass; $gen->id = 1; $g = gen($gen); $g->current(); $g->send("Hello World"); var_dump($g, $gen);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cIqdf
function name:  (null)
number of ops:  19
compiled vars:  !0 = $gen, !1 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $2      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    7     3        ASSIGN_OBJ                                               !0, 'id'
          4        OP_DATA                                                  1
    9     5        INIT_FCALL                                               'gen'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $6      
          8        ASSIGN                                                   !1, $6
   10     9        INIT_METHOD_CALL                                         !1, 'current'
         10        DO_FCALL                                      0          
   11    11        INIT_METHOD_CALL                                         !1, 'send'
         12        SEND_VAL_EX                                              'Hello+World'
         13        DO_FCALL                                      0          
   12    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !1
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/cIqdf
function name:  gen
number of ops:  6
compiled vars:  !0 = $gen, !1 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    3     2        FETCH_OBJ_R                                      ~2      !0, 'id'
          3        YIELD                                            $3      ~2
          4        ASSIGN                                                   !1, $3
    4     5      > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.26 ms | 1397 KiB | 16 Q