3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); class Cl { public string $name; public function __get(string $n) { var_dump('__get: ' . $n); return '5'; } } $obj = new Cl(); // read on uninitialized typed property try { $obj->name; } catch (\Error $e) { echo $e->getMessage() . "\n"; } // read on unset typed property unset($obj->name); try { var_dump($obj->name); } catch (\Error $e) { echo $e->getMessage() . "\n"; } try { var_dump($obj->name); } catch (\Error $e) { echo $e->getMessage() . "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Typed property Cl::$name must not be accessed before initialization string(11) "__get: name" string(1) "5" string(11) "__get: name" string(1) "5"

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