3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} class B {} class C {} class D { public function __construct(A $a, B $b, C $c) { // ... } public function doSomething() { return 'Did something with ' . $this->a . ', ' . $this->b . ', ' . $this->c; } } class D_Proxy extends D { private $serviceLocator; private $original; public function __construct(ServiceLocator $serviceLocator) { $this->serviceLocator = $serviceLocator; } private function initialize() { $this->initialized = true; $this->original = $this->serviceLocator->get('D'); } public function doSomething() { if ( ! $this->initialized) { $this->initialize(); } return $this->original->doSomething(); } } class HelloWorld { public function __construct(D $d) { // ... } public function sayHello() { return 'Hello World'; } public function doSomethingWithD() { return $this->d->doSomething(); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X2JmD
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   64     0  E > > RETURN                                                   1

Class A: [no user functions]
Class B: [no user functions]
Class C: [no user functions]
Class D:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X2JmD
function name:  __construct
number of ops:  4
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   14     3      > RETURN                                                   null

End of function __construct

Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X2JmD
function name:  doSomething
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~0      'a'
          1        CONCAT                                           ~1      'Did+something+with+', ~0
          2        CONCAT                                           ~2      ~1, '%2C+'
          3        FETCH_OBJ_R                                      ~3      'b'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '%2C+'
          6        FETCH_OBJ_R                                      ~6      'c'
          7        CONCAT                                           ~7      ~5, ~6
          8      > RETURN                                                   ~7
   19     9*     > RETURN                                                   null

End of function dosomething

End of class D.

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

End of function __construct

Function initialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X2JmD
function name:  initialize
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   ASSIGN_OBJ                                               'initialized'
          1        OP_DATA                                                  <true>
   35     2        FETCH_OBJ_R                                      ~2      'serviceLocator'
          3        INIT_METHOD_CALL                                         ~2, 'get'
          4        SEND_VAL_EX                                              'D'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN_OBJ                                               'original'
          7        OP_DATA                                                  $3
   36     8      > RETURN                                                   null

End of function initialize

Function dosomething:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/X2JmD
function name:  doSomething
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   FETCH_OBJ_R                                      ~0      'initialized'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->5
   41     3    >   INIT_METHOD_CALL                                         'initialize'
          4        DO_FCALL                                      0          
   44     5    >   FETCH_OBJ_R                                      ~3      'original'
          6        INIT_METHOD_CALL                                         ~3, 'doSomething'
          7        DO_FCALL                                      0  $4      
          8      > RETURN                                                   $4
   45     9*     > RETURN                                                   null

End of function dosomething

End of class D_Proxy.

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

End of function __construct

Function sayhello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X2JmD
function name:  sayHello
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E > > RETURN                                                   'Hello+World'
   58     1*     > RETURN                                                   null

End of function sayhello

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

End of function dosomethingwithd

End of class HelloWorld.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.05 ms | 1399 KiB | 13 Q