3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ArrayExtended implements ArrayAccess{ protected $ary = array(); public function __construct(array $a = null) { if($a) $this->ary = $a; } // Useful methods public function reverse() { $this->ary = array_reverse($this->ary); return $this; } // Mandatory methods for ArrayAccess implementation public function offsetExists($off){} public function offsetGet($off){} public function offsetSet($off,$val){} public function offsetUnset($off){} } $o = new ArrayExtended(array('a','b')); $o[] = 'c'; print_r($o);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of ArrayExtended::offsetExists($off) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/G60pk on line 17 Deprecated: Return type of ArrayExtended::offsetGet($off) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/G60pk on line 18 Deprecated: Return type of ArrayExtended::offsetSet($off, $val) 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/G60pk on line 19 Deprecated: Return type of ArrayExtended::offsetUnset($off) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/G60pk on line 20 ArrayExtended Object ( [ary:protected] => Array ( [0] => a [1] => b ) )

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:
51.56 ms | 403 KiB | 8 Q