3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $fooId; private $fooName; public function __set($name, $value) { $this->$name = $value; } public function __get($name) { if (self::__isset($name)) { return $this->$name; } $trace = debug_backtrace(); trigger_error( 'Undefined property ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE); return null; } public function __isset($name) { return isset($this->$name); } } $bar = new Foo(); $bar->fooId = 2; $bar->fooName = 'Name'; var_dump($bar); printf($bar->check);
Output for git.master, git.master_jit, rfc.property-hooks
object(Foo)#1 (2) { ["fooId":"Foo":private]=> int(2) ["fooName":"Foo":private]=> string(4) "Name" } Notice: Undefined property check in /in/j37FU on line 41 in /in/j37FU on line 19 Deprecated: printf(): Passing null to parameter #1 ($format) of type string is deprecated in /in/j37FU on line 41

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:
65.95 ms | 401 KiB | 8 Q