<?php
class Red {
public static function b_func() {
static::a_func();
}
public static function a_func() {
echo "Colour is ",__CLASS__."\n";
}
}
class Blue extends Red {
public static function run() {
Red::b_func();
parent ::b_func();
self::b_func();
}
public static function a_func() {
echo "Colour is ",__CLASS___."\n";
}
}
class Green extends Blue {
public static function a_func() {
echo "Colour is ",___CLASS___."\n";
}
}
Green::run();
?>
Colour is Red
Colour is
Fatal error: Uncaught Error: Undefined constant "___CLASS___" in /in/oSuKa:22
Stack trace:
#0 /in/oSuKa(4): Green::a_func()
#1 /in/oSuKa(13): Red::b_func()
#2 /in/oSuKa(25): Blue::run()
#3 {main}
thrown in /in/oSuKa on line 22
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Colour is Red
Colour is
Fatal error: Uncaught Error: Undefined constant "___CLASS___" in /in/oSuKa:22
Stack trace:
#0 /in/oSuKa(4): Green::a_func()
#1 /in/oSuKa(13): Red::b_func()
#2 /in/oSuKa(25): Blue::run()
#3 {main}
thrown in /in/oSuKa on line 22
Process exited with code 255.
Colour is Red
Colour is
Warning: Use of undefined constant ___CLASS___ - assumed '___CLASS___' (this will throw an Error in a future version of PHP) in /in/oSuKa on line 22
___CLASS___
Colour is
Warning: Use of undefined constant ___CLASS___ - assumed '___CLASS___' (this will throw an Error in a future version of PHP) in /in/oSuKa on line 22
___CLASS___
Output for 5.6.38, 7.1.0 - 7.1.25
Colour is Red
Colour is
Notice: Use of undefined constant ___CLASS___ - assumed '___CLASS___' in /in/oSuKa on line 22
___CLASS___
Colour is
Notice: Use of undefined constant ___CLASS___ - assumed '___CLASS___' in /in/oSuKa on line 22
___CLASS___