3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $string; private $array; public function __set($attribute, $value) { $this->$attribute = $value; } public function __get($attribute) { if (isset($attribute)) { return $this->$attribute; } } } $obg = new MyClass(); $obg->string = 'Hey it works!'; $obg->array = new ArrayObject(['This works', 'too!']); $obg->array['key'] = "This will throw 'Indirect modification of overloaded property MyClass::\$array has no effect'"; print_r($obg->array->getArrayCopy());
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => This works [1] => too! [key] => This will throw 'Indirect modification of overloaded property MyClass::$array has no effect' )

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