3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { const CONSTANT = 'const'; public static function func() { return __METHOD__; } } $class = 'x'; $constant = 'CONSTANT'; $function = 'func'; $classConstant = $class . '::' . $constant; $classFunc1 = array($class, $function); $classFunc2 = $class . '::' . $function; var_dump(x::CONSTANT); var_dump(x::func()); var_dump($class::CONSTANT); var_dump($class::func()); var_dump($class::$function()); var_dump($classFunc1()); //var_dump($classFunc2()); var_dump(x::undefined());
Output for git.master, git.master_jit, rfc.property-hooks
string(5) "const" string(7) "x::func" string(5) "const" string(7) "x::func" string(7) "x::func" string(7) "x::func" Fatal error: Uncaught Error: Call to undefined method x::undefined() in /in/1spvg:26 Stack trace: #0 {main} thrown in /in/1spvg on line 26
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:
38.85 ms | 401 KiB | 8 Q