3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function testA(){ echo "AA"; } } class B extends A{ public function testB(){ echo "BB"; } } class C extends B{ //Here i am able to call class B's function like public function testB(){ parent::testB(); } //but not able to call Class A's function public function testB1(){ $this->testA(); // Here its giving error } } $class = new C; $class->testB(); echo PHP_EOL; $class->testB1();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MbbuE
function name:  (null)
number of ops:  9
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $1      'C'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        INIT_METHOD_CALL                                         !0, 'testB'
          4        DO_FCALL                                      0          
   30     5        ECHO                                                     '%0A'
   31     6        INIT_METHOD_CALL                                         !0, 'testB1'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

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

End of function testa

End of class A.

Class B:
Function testb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MbbuE
function name:  testB
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                     'BB'
   12     1      > RETURN                                                   null

End of function testb

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

End of function testa

End of class B.

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

End of function testb

Function testb1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MbbuE
function name:  testB1
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_METHOD_CALL                                         'testA'
          1        DO_FCALL                                      0          
   24     2      > RETURN                                                   null

End of function testb1

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

End of function testa

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.74 ms | 1015 KiB | 13 Q