3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IssetArray extends \ArrayObject { public function &offsetGet($offset) { $var = $this->offsetExists($offset) ? parent::offsetGet($offset) : null; return $var; } } $array = new \IssetArray(); $array['item'] = 123; var_dump($array['item']); var_dump($array['item']['foo']); var_dump($array['something']['noItem']); $array['something']['foo'] = 'bar'; var_dump($array['something']['foo']);
Output for git.master, git.master_jit
Deprecated: Return type of & IssetArray::offsetGet($offset) should either be compatible with ArrayObject::offsetGet(mixed $key): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/nAi6h on line 5 int(123) Warning: Trying to access array offset on value of type int in /in/nAi6h on line 15 NULL Warning: Trying to access array offset on value of type null in /in/nAi6h on line 16 NULL Warning: Trying to access array offset on value of type null in /in/nAi6h on line 19 NULL
Output for rfc.property-hooks
Deprecated: Return type of & IssetArray::offsetGet($offset) should either be compatible with ArrayObject::offsetGet(mixed $key): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/nAi6h on line 5 int(123) Warning: Trying to access array offset on int in /in/nAi6h on line 15 NULL Warning: Trying to access array offset on null in /in/nAi6h on line 16 NULL Warning: Trying to access array offset on null in /in/nAi6h on line 19 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:
30.66 ms | 408 KiB | 5 Q