3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { public static function status() { static::getStatus(); } protected static function getStatus() { echo "Person is alive"; } } //If we call Person::status() we will see "Person is alive" . Now consider what happens when we make a class that inherits from this: class Deceased extends Person { protected static function getStatus() { echo "Person is deceased"; } } Deceased::status();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3Mu8k
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_STATIC_METHOD_CALL                                  'Deceased', 'status'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

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

End of function status

Function getstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3Mu8k
function name:  getStatus
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     'Person+is+alive'
   13     1      > RETURN                                                   null

End of function getstatus

End of class Person.

Class Deceased:
Function getstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3Mu8k
function name:  getStatus
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ECHO                                                     'Person+is+deceased'
   24     1      > RETURN                                                   null

End of function getstatus

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

End of function status

End of class Deceased.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.84 ms | 1395 KiB | 13 Q