3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $bar; public function __construct(BarInterface $bar) { $this->bar = $bar; } public function doAction() { $bar->getVar(); } } interface BarInterface { public function getVar(); } abstract class BarAbscract implements BarInterface { public function getVar() { return $this->var; } } class Bar extends BarAbscract { protected $var = __CLASS__; } class Baz extends BarAbstract { protected $var = __CLASS__; } $bar = new Bar(); $foo = new Foo($bar); $foo->doAction();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADAl3
function name:  (null)
number of ops:  13
compiled vars:  !0 = $bar, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   DECLARE_CLASS                                            'barabscract'
   31     1        DECLARE_CLASS                                            'bar', 'barabscract'
   36     2        DECLARE_CLASS                                            'baz', 'barabstract'
   41     3        NEW                                              $2      'Bar'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   42     6        NEW                                              $5      'Foo'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $5
   43    10        INIT_METHOD_CALL                                         !1, 'doAction'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

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

End of function __construct

Function doaction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADAl3
function name:  doAction
number of ops:  3
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_METHOD_CALL                                         !0, 'getVar'
          1        DO_FCALL                                      0          
   14     2      > RETURN                                                   null

End of function doaction

End of class Foo.

Class BarInterface:
Function getvar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADAl3
function name:  getVar
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E > > RETURN                                                   null

End of function getvar

End of class BarInterface.

Class BarAbscract:
Function getvar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ADAl3
function name:  getVar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      'var'
          1      > RETURN                                                   ~0
   27     2*     > RETURN                                                   null

End of function getvar

End of class BarAbscract.

Class Bar: [no user functions]
Class Baz: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.24 ms | 1399 KiB | 13 Q