3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Thing extends ArrayObject { public function __construct(array $data) { parent::__construct($data, self::ARRAY_AS_PROPS); } public function offsetSet($index, $value) { parent::offsetSet($index, $value); return $this; } public function &offsetGet($index) { if (!$this->offsetExists($index)) { $this[$index] = null; } return parent::offsetGet($index); } } $test = new Thing([]); $test->dynamic['key'] = ['is-set' => 'up to 7.1.3']; var_dump($test);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of & Thing::offsetGet($index) should either be compatible with ArrayObject::offsetGet(mixed $key): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/KVqfH on line 15 Deprecated: Return type of Thing::offsetSet($index, $value) should either be compatible with ArrayObject::offsetSet(mixed $key, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/KVqfH on line 10 Notice: Only variable references should be returned by reference in /in/KVqfH on line 19 object(Thing)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { ["dynamic"]=> NULL } }

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:
32.09 ms | 402 KiB | 8 Q