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() { yield (new X($this)); return 12; } $a = gen(); 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/IP1jG
function name:  (null)
number of ops:  16
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'gen'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   14     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'current'
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   15     8        INIT_METHOD_CALL                                         !0, 'next'
          9        DO_FCALL                                      0          
   16    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'getReturn'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/IP1jG
function name:  gen
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   GENERATOR_CREATE                                         
    9     1        NEW                                              $0      'X'
          2        FETCH_THIS                                       $1      
          3        SEND_VAR_EX                                              $1
          4        DO_FCALL                                      0          
          5        YIELD                                                    $0
   10     6      > GENERATOR_RETURN                                         
   11     7*     > 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/IP1jG
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/IP1jG
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:
144.07 ms | 1403 KiB | 16 Q