3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C implements ArrayAccess { public function offsetGet($k) { echo "offsetGet: "; var_dump($k); } public function offsetSet($k, $v) { echo "offsetSet: "; var_dump($k); } public function offsetExists($k) { echo "offsetExists: "; var_dump($k); } public function offsetUnset($k) { echo "offsetUnset: "; var_dump($k); } } $x = new C(); $k = '123'; var_dump($x[$k]); var_dump($x[$k] = 4); var_dump(isset($x[$k])); unset($x[$k]);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of C::offsetExists($k) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/A1g1f on line 11 Deprecated: Return type of C::offsetGet($k) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/A1g1f on line 3 Deprecated: Return type of C::offsetSet($k, $v) 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/A1g1f on line 7 Deprecated: Return type of C::offsetUnset($k) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/A1g1f on line 15 offsetGet: string(3) "123" NULL offsetSet: string(3) "123" int(4) offsetExists: string(3) "123" bool(false) offsetUnset: string(3) "123"

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