3v4l.org

run code in 300+ PHP versions simultaneously
<?php class class2{} class class1{ public function __construct() { } function get_class_2_object() :class2{ return new class2; } } $a = new class1; $b = $a->get_class_2_object(); var_dump($b); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2cNv1
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $2      'class1'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   11     3        INIT_METHOD_CALL                                         !0, 'get_class_2_object'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   12     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   13     9      > RETURN                                                   1

Class class2: [no user functions]
Class class1:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2cNv1
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   null

End of function __construct

Function get_class_2_object:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2cNv1
function name:  get_class_2_object
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $0      'class2'
          1        DO_FCALL                                      0          
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
    8     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function get_class_2_object

End of class class1.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.19 ms | 1395 KiB | 15 Q