3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class A extends B { private $B; public function __construct(array $config) { $this->B = new B($config); } public function check(int $id) { if ( $this->checkSomething($id) ) { // ... } } public function setLang(string $lang) { $this->repository->setLang($lang); } public function getB() { return $B; } } class B { protected $repository; protected function __construct(array $config) { $this->repository = new Repository ($config); } protected function checkSomething(int $id) { if ( $this->repository->checkById($id) ) { return TRUE; } } public function get() { return 'whatever'; } } $config = ['some', 'config']; $A = new A($config); echo $A->getB()->get();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1TYDT
function name:  (null)
number of ops:  12
compiled vars:  !0 = $config, !1 = $A
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'a', 'b'
   44     1        ASSIGN                                                   !0, <array>
   45     2        NEW                                              $3      'A'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
   46     6        INIT_METHOD_CALL                                         !1, 'getB'
          7        DO_FCALL                                      0  $6      
          8        INIT_METHOD_CALL                                         $6, 'get'
          9        DO_FCALL                                      0  $7      
         10        ECHO                                                     $7
         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/1TYDT
function name:  __construct
number of ops:  7
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        NEW                                              $2      'B'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN_OBJ                                               'B'
          5        OP_DATA                                                  $2
    8     6      > RETURN                                                   null

End of function __construct

Function check:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 5
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/1TYDT
function name:  check
number of ops:  6
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        INIT_METHOD_CALL                                         'checkSomething'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ                                                     $1, ->5
   15     5    > > RETURN                                                   null

End of function check

Function setlang:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1TYDT
function name:  setLang
number of ops:  6
compiled vars:  !0 = $lang
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        FETCH_OBJ_R                                      ~1      'repository'
          2        INIT_METHOD_CALL                                         ~1, 'setLang'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   19     5      > RETURN                                                   null

End of function setlang

Function getb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1TYDT
function name:  getB
number of ops:  2
compiled vars:  !0 = $B
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E > > RETURN                                                   !0
   23     1*     > RETURN                                                   null

End of function getb

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1TYDT
function name:  __construct
number of ops:  7
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   30     1        NEW                                              $2      'Repository'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN_OBJ                                               'repository'
          5        OP_DATA                                                  $2
   31     6      > RETURN                                                   null

End of function __construct

Function checksomething:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1TYDT
function name:  checkSomething
number of ops:  8
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   34     1        FETCH_OBJ_R                                      ~1      'repository'
          2        INIT_METHOD_CALL                                         ~1, 'checkById'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5      > JMPZ                                                     $2, ->7
   36     6    > > RETURN                                                   <true>
   38     7    > > RETURN                                                   null

End of function checksomething

Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1TYDT
function name:  get
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E > > RETURN                                                   'whatever'
   42     1*     > RETURN                                                   null

End of function get

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.13 ms | 1399 KiB | 13 Q