3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $untyped = 'old'; private string $typed = 'old'; public function clear() { unset($this->untyped); unset($this->typed); } } $foo = new Foo; var_dump($foo); $foo->clear(); var_dump($foo); try { $foo->untyped = 'new'; } catch (Error $e) { echo "\n", $e, "\n"; } try { $foo->typed = 'new'; } catch (Error $e) { echo "\n", $e, "\n"; } var_dump($foo);
Output for git.master, git.master_jit, rfc.property-hooks
object(Foo)#1 (2) { ["untyped":"Foo":private]=> string(3) "old" ["typed":"Foo":private]=> string(3) "old" } object(Foo)#1 (0) { ["typed":"Foo":private]=> uninitialized(string) } Error: Cannot access private property Foo::$untyped in /in/DgXJl:18 Stack trace: #0 {main} Error: Cannot access private property Foo::$typed in /in/DgXJl:23 Stack trace: #0 {main} object(Foo)#1 (0) { ["typed":"Foo":private]=> uninitialized(string) }

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:
26.88 ms | 406 KiB | 5 Q