3v4l.org

run code in 300+ PHP versions simultaneously
<?php class GlobalArrayWrapper implements ArrayAccess { protected $values = []; public function __construct(array $values) { $this->values = $values; } /** * {@inheritdoc} */ public function offsetExists($offset) { trigger_error('You are doing it wrong', E_USER_DEPRECATED); return isset($this->values[$offset]); } /** * {@inheritdoc} */ public function offsetGet($offset) { trigger_error('You are doing it wrong', E_USER_DEPRECATED); return $this->values[$offset] ?? NULL; } /** * {@inheritdoc} */ public function offsetSet($offset, $value) { trigger_error('You are doing it wrong', E_USER_DEPRECATED); return $this->values[$offset] = $value; } /** * {@inheritdoc} */ public function offsetUnset($offset) { trigger_error('You are doing it wrong', E_USER_DEPRECATED); unset($this->values[$offset]); } } $GLOBALS['pager_page_array'] = [1, 2]; $GLOBALS['pager_page_array'] = new GlobalArrayWrapper($GLOBALS['pager_page_array']); echo $GLOBALS['pager_page_array'][0];
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of GlobalArrayWrapper::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/AlHZK on line 11 Deprecated: Return type of GlobalArrayWrapper::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/AlHZK on line 19 Deprecated: Return type of GlobalArrayWrapper::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/AlHZK on line 27 Deprecated: Return type of GlobalArrayWrapper::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/AlHZK on line 35 Deprecated: You are doing it wrong in /in/AlHZK on line 20 1

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:
139.02 ms | 409 KiB | 5 Q