3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $b; public function __construct($b) { $this->b = $b; } public function methodA() { return $this->b; } } class ProxyA extends A { private $proxied; public function methodA() { return $this->proxied->methodA(); } public function methodB() { return true; } public static function makeProxy(A $instance) { $rc = new \ReflectionClass(get_class($instance)); $proxy = $rc->newInstanceWithoutConstructor(); $proxy->proxied = $instance; return $proxy; } } var_dump(ProxyA::makeProxy(new A(1234))->methodB());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGDYp
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'ProxyA', 'makeProxy'
          2        NEW                                              $0      'A'
          3        SEND_VAL_EX                                              1234
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $0
          6        DO_FCALL                                      0  $2      
          7        INIT_METHOD_CALL                                         $2, 'methodB'
          8        DO_FCALL                                      0  $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

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

End of function __construct

Function methoda:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGDYp
function name:  methodA
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'b'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function methoda

End of class A.

Class ProxyA:
Function methoda:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGDYp
function name:  methodA
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   FETCH_OBJ_R                                      ~0      'proxied'
          1        INIT_METHOD_CALL                                         ~0, 'methodA'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
   25     4*     > RETURN                                                   null

End of function methoda

Function methodb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGDYp
function name:  methodB
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E > > RETURN                                                   <true>
   30     1*     > RETURN                                                   null

End of function methodb

Function makeproxy:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGDYp
function name:  makeProxy
number of ops:  13
compiled vars:  !0 = $instance, !1 = $rc, !2 = $proxy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   34     1        NEW                                              $3      'ReflectionClass'
          2        GET_CLASS                                        ~4      !0
          3        SEND_VAL_EX                                              ~4
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
   36     6        INIT_METHOD_CALL                                         !1, 'newInstanceWithoutConstructor'
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
   37     9        ASSIGN_OBJ                                               !2, 'proxied'
         10        OP_DATA                                                  !0
   39    11      > RETURN                                                   !2
   40    12*     > RETURN                                                   null

End of function makeproxy

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

End of function __construct

End of class ProxyA.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.33 ms | 1392 KiB | 15 Q