3v4l.org

run code in 300+ PHP versions simultaneously
<?php class GenClass { function __construct() { echo "Making GenClass\n"; } function __destruct() { echo "Destroying GenClass\n"; } function genInner() { throw new Exception; yield 5; } } function genOuter() { $x = (new GenClass)->genInner(); // $x is now a generator containing the only reference to a GenClass yield from $x; } genOuter()->next();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iTdQJ
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'genouter'
          1        DO_FCALL                                      0  $0      
          2        INIT_METHOD_CALL                                         $0, 'next'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function genouter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/iTdQJ
function name:  genOuter
number of ops:  9
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   GENERATOR_CREATE                                         
   10     1        NEW                                              $1      'GenClass'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $1, 'genInner'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !0, $3
   11     6        YIELD_FROM                                       ~5      !0
          7        FREE                                                     ~5
   12     8      > GENERATOR_RETURN                                         

End of function genouter

Class GenClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iTdQJ
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                     'Making+GenClass%0A'
          1      > 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/iTdQJ
function name:  __destruct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'Destroying+GenClass%0A'
          1      > RETURN                                                   null

End of function __destruct

Function geninner:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/iTdQJ
function name:  genInner
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   GENERATOR_CREATE                                         
          1        NEW                                              $0      'Exception'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $0
          4*       YIELD                                                    5
          5*     > GENERATOR_RETURN                                         

End of function geninner

End of class GenClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.6 ms | 1399 KiB | 14 Q