3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public int $bar; public function __get($name) { echo "__get\n"; return 43; } public function __set($name, $value) { echo "__set\n"; } } $foo = new Foo(); echo "Read before assignment:\n"; try { echo $foo->bar, "\n"; } catch (Throwable $e) { echo $e->getMessage(), "\n"; } echo "Assignment before unset:\n"; $foo->bar = 42; unset($foo->bar); echo "Assignment after unset:\n"; $foo->bar = 42; echo "Read after unset:\n"; echo $foo->bar, "\n";
Output for git.master, git.master_jit, rfc.property-hooks
Read before assignment: Typed property Foo::$bar must not be accessed before initialization Assignment before unset: Assignment after unset: __set Read after unset: __get 43

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:
29.6 ms | 405 KiB | 5 Q