3v4l.org

run code in 300+ PHP versions simultaneously
<?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(); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
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___

preferences:
179.69 ms | 402 KiB | 178 Q