3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C implements ArrayAccess { public function offsetGet($offset) { return 'value'; } public function offsetExists($offset) { if ($offset == 'pWithNull') { return null; } if ($offset == 'pWithFalse') { return false; } if ($offset == 'pWithTrue') { return true; } return false; } public function offsetSet($offset, $value) { // nothing } } $o = new C(); var_dump( isset($o->pWithFalse), empty($o->pWithFalse) ); var_dump( isset($o->pWithNull), empty($o->pWithNull) ); var_dump( isset($o->pWithTrue), empty($o->pWithTrue) );
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of C::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/Okuv4 on line 9 Deprecated: Return type of C::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/Okuv4 on line 4 Deprecated: Return type of C::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/Okuv4 on line 23 Fatal error: Class C contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (ArrayAccess::offsetUnset) in /in/Okuv4 on line 3
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:
54.28 ms | 402 KiB | 8 Q