3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SpecialArray implements \ArrayAccess { public function offsetExists($index){} public function offsetGet($index){} public function offsetSet($index, $value){} public function offsetUnset($index){} } $arr = new SpecialArray; $arr[] = 1; $arr[] = 2; $arr[] = 3; var_dump(count($arr));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of SpecialArray::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/G0pR3 on line 5 Deprecated: Return type of SpecialArray::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/G0pR3 on line 6 Deprecated: Return type of SpecialArray::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/G0pR3 on line 7 Deprecated: Return type of SpecialArray::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/G0pR3 on line 8 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, SpecialArray given in /in/G0pR3:16 Stack trace: #0 {main} thrown in /in/G0pR3 on line 16
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:
34.28 ms | 406 KiB | 9 Q