3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { function __construct($gen) { $this->gen = $gen; } function __destruct() { var_dump($this->gen->current()); } } function gen() { $self = yield (0); yield (new X($self)); return 12; } $a = gen(); var_dump($a->current()); $a->send($a); var_dump($a->current()); $a->next(); var_dump($a->getReturn());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mXXiu
function name:  (null)
number of ops:  24
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'gen'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   15     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'current'
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   16     8        INIT_METHOD_CALL                                         !0, 'send'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
   17    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'current'
         13        DO_FCALL                                      0  $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
   18    16        INIT_METHOD_CALL                                         !0, 'next'
         17        DO_FCALL                                      0          
   19    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !0, 'getReturn'
         20        DO_FCALL                                      0  $9      
         21        SEND_VAR                                                 $9
         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/mXXiu
function name:  gen
number of ops:  9
compiled vars:  !0 = $self
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   GENERATOR_CREATE                                         
    9     1        YIELD                                            $1      0
          2        ASSIGN                                                   !0, $1
   10     3        NEW                                              $3      'X'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        YIELD                                                    $3
   11     7      > GENERATOR_RETURN                                         
   12     8*     > GENERATOR_RETURN                                         

End of function gen

Class X:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mXXiu
function name:  __construct
number of ops:  4
compiled vars:  !0 = $gen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'gen'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mXXiu
function name:  __destruct
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_OBJ_R                                      ~0      'gen'
          2        INIT_METHOD_CALL                                         ~0, 'current'
          3        DO_FCALL                                      0  $1      
          4        SEND_VAR                                                 $1
          5        DO_ICALL                                                 
          6      > RETURN                                                   null

End of function __destruct

End of class X.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.23 ms | 1403 KiB | 16 Q