3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { const Bar = 123; static $Bar = 456; } function tryEval(string $code) { $foo = new Foo; try { eval($code); } catch(Throwable $e) { echo $e, "\n"; } echo "\n"; } tryEval('echo "{$foo::$Bar}\n";'); tryEval('echo "{$foo::Bar}\n";'); tryEval('echo "{$foo::class}\n";');
Output for git.master, git.master_jit
456 ParseError: syntax error, unexpected token "}", expecting "->" or "?->" or "{" or "[" in /in/hTnNv(11) : eval()'d code:1 Stack trace: #0 /in/hTnNv(19): tryEval('echo "{$foo::Ba...') #1 {main} ParseError: syntax error, unexpected token "}", expecting "->" or "?->" or "{" or "[" in /in/hTnNv(11) : eval()'d code:1 Stack trace: #0 /in/hTnNv(20): tryEval('echo "{$foo::cl...') #1 {main}
Output for rfc.property-hooks
456 ParseError: syntax error, unexpected token "}", expecting "->" or "?->" or "[" in /in/hTnNv(11) : eval()'d code:1 Stack trace: #0 /in/hTnNv(19): tryEval('echo "{$foo::Ba...') #1 {main} ParseError: syntax error, unexpected token "}", expecting "->" or "?->" or "[" in /in/hTnNv(11) : eval()'d code:1 Stack trace: #0 /in/hTnNv(20): tryEval('echo "{$foo::cl...') #1 {main}

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:
87.68 ms | 407 KiB | 5 Q