3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private static function VALUE1(){ return 'func'; } private static $VALUE2 = 'var'; private const VALUE3 = 'cost'; public static function func_value(){ return static::VALUE1(); } public static function member_value(){ return static::$VALUE2; } public static function const_value(){ return static::VALUE3; } } class B extends A { } echo A::func_value(); echo "\n"; echo B::func_value(); echo "\n---\n"; echo A::member_value(); echo "\n"; echo B::member_value(); echo "\n---\n"; echo A::const_value(); echo "\n"; echo B::const_value();
Output for git.master, git.master_jit, rfc.property-hooks
func func --- var var --- cost Fatal error: Uncaught Error: Undefined constant B::VALUE3 in /in/HiPuc:22 Stack trace: #0 /in/HiPuc(43): A::const_value() #1 {main} thrown in /in/HiPuc on line 22
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.4 ms | 401 KiB | 8 Q