3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T { private function a() { return "T/a\n"; } public function callAFromT() { return $this->a(); } } class X { use T; private function a() { return "X/a\n"; } public function callAFromX() { return $this->a(); } } class Y extends X { private function a() { return "Y/a\n"; } public function callAFromY() { return $this->a(); } } $y = new Y; echo $y->callAFromY(); // outputs "Y/a" echo $y->callAFromX(); // outputs "X/a" echo $y->callAFromT(); // expected: "T/a"; outputs "X/a";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rVOjU
function name:  (null)
number of ops:  15
compiled vars:  !0 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'x'
   22     1        DECLARE_CLASS                                            'y', 'x'
   31     2        NEW                                              $1      'Y'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   32     5        INIT_METHOD_CALL                                         !0, 'callAFromY'
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
   33     8        INIT_METHOD_CALL                                         !0, 'callAFromX'
          9        DO_FCALL                                      0  $5      
         10        ECHO                                                     $5
   34    11        INIT_METHOD_CALL                                         !0, 'callAFromT'
         12        DO_FCALL                                      0  $6      
         13        ECHO                                                     $6
         14      > RETURN                                                   1

Class T:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rVOjU
function name:  a
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   'T%2Fa%0A'
    6     1*     > RETURN                                                   null

End of function a

Function callafromt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rVOjU
function name:  callAFromT
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_METHOD_CALL                                         'a'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
    9     3*     > RETURN                                                   null

End of function callafromt

End of class T.

Class X:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rVOjU
function name:  a
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > RETURN                                                   'X%2Fa%0A'
   16     1*     > RETURN                                                   null

End of function a

Function callafromx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rVOjU
function name:  callAFromX
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_METHOD_CALL                                         'a'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   19     3*     > RETURN                                                   null

End of function callafromx

End of class X.

Class Y:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rVOjU
function name:  a
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E > > RETURN                                                   'Y%2Fa%0A'
   25     1*     > RETURN                                                   null

End of function a

Function callafromy:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rVOjU
function name:  callAFromY
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_METHOD_CALL                                         'a'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   28     3*     > RETURN                                                   null

End of function callafromy

End of class Y.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.9 ms | 1000 KiB | 13 Q