3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Proxy extends Base { public function __construct($initializer) { // do proxy initializing stuff, NOT calling base object's (i.e. parent's) constructor } } class Base { public function __construct($data) { echo $data; } } $proxy = new Proxy(function(){}); $reflection = new ReflectionObject($proxy); $parentReflection = $reflection->getParentClass(); $parentConstructor = $parentReflection->getMethod('__construct'); $parentConstructor->invoke($proxy, 'Hello world!');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/932Zp
function name:  (null)
number of ops:  22
compiled vars:  !0 = $proxy, !1 = $reflection, !2 = $parentReflection, !3 = $parentConstructor
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'proxy', 'base'
   14     1        NEW                                              $4      'Proxy'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F932Zp%3A14%241'
          3        SEND_VAL_EX                                              ~5
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $4
   16     6        NEW                                              $8      'ReflectionObject'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $8
   17    10        INIT_METHOD_CALL                                         !1, 'getParentClass'
         11        DO_FCALL                                      0  $11     
         12        ASSIGN                                                   !2, $11
   18    13        INIT_METHOD_CALL                                         !2, 'getMethod'
         14        SEND_VAL_EX                                              '__construct'
         15        DO_FCALL                                      0  $13     
         16        ASSIGN                                                   !3, $13
   19    17        INIT_METHOD_CALL                                         !3, 'invoke'
         18        SEND_VAR_EX                                              !0
         19        SEND_VAL_EX                                              'Hello+world%21'
         20        DO_FCALL                                      0          
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F932Zp%3A14%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/932Zp
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F932Zp%3A14%241

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

End of function __construct

End of class Proxy.

Class Base:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/932Zp
function name:  __construct
number of ops:  3
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        ECHO                                                     !0
   12     2      > RETURN                                                   null

End of function __construct

End of class Base.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.41 ms | 1399 KiB | 13 Q