3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C extends ArrayObject { public function getArrayCopy() {return [__METHOD__];} public function getIterator() {yield __METHOD__;} public function serialize() {return serialize([__METHOD__]);} public function unserialize($data) {} public function offsetGet($key) {return __METHOD__;} public function offsetExists($key) {return TRUE;} public function offsetSet($key, $value) {} public function offsetUnset($key) {} } $o = new C(['x' => 5]); var_export([ 'json' => json_encode($o), '(array)' => (array) $o, '->x' => $o->x, ]);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of C::offsetExists($key) should either be compatible with ArrayObject::offsetExists(mixed $key): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rAc4K on line 9 Deprecated: Return type of C::offsetGet($key) should either be compatible with ArrayObject::offsetGet(mixed $key): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rAc4K on line 8 Deprecated: Return type of C::offsetSet($key, $value) should either be compatible with ArrayObject::offsetSet(mixed $key, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rAc4K on line 10 Deprecated: Return type of C::offsetUnset($key) should either be compatible with ArrayObject::offsetUnset(mixed $key): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rAc4K on line 11 Deprecated: Return type of C::getArrayCopy() should either be compatible with ArrayObject::getArrayCopy(): array, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rAc4K on line 4 Deprecated: Return type of C::unserialize($data) should either be compatible with ArrayObject::unserialize(string $data): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rAc4K on line 7 Deprecated: Return type of C::serialize() should either be compatible with ArrayObject::serialize(): string, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rAc4K on line 6 Deprecated: Return type of C::getIterator() should either be compatible with ArrayObject::getIterator(): Iterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/rAc4K on line 5 Warning: Undefined property: C::$x in /in/rAc4K on line 19 array ( 'json' => '{"x":5}', '(array)' => array ( 'x' => 5, ), '->x' => NULL, )

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:
93.05 ms | 409 KiB | 8 Q