3v4l.org

run code in 300+ PHP versions simultaneously
<?php // essentially tests/classes/array_access_012.phpt, with offsetGet returning by-ref class ArrayAccessImpl implements ArrayAccess { private $data = array(); public function offsetUnset($index) {} public function offsetSet($index, $value) { $this->data[$index] = $value; } public function &offsetGet($index) { return $this->data[$index]; } public function offsetExists($index) { return isset($this->data[$index]); } } $data = new ArrayAccessImpl(); $test = 'some data'; $data['element'] = NULL; // prevent notice $data['element'] = &$test; var_dump($data['element']);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of ArrayAccessImpl::offsetExists($index) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/UmZcJ on line 17 Deprecated: Return type of & ArrayAccessImpl::offsetGet($index) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/UmZcJ on line 13 Deprecated: Return type of ArrayAccessImpl::offsetSet($index, $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/UmZcJ on line 9 Deprecated: Return type of ArrayAccessImpl::offsetUnset($index) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/UmZcJ on line 7 Fatal error: Uncaught Error: Cannot assign by reference to an array dimension of an object in /in/UmZcJ:25 Stack trace: #0 {main} thrown in /in/UmZcJ on line 25
Process exited with code 255.

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