3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeArray extends ArrayObject { public function __construct($array) { var_dump('Called: '.__METHOD__); parent::__construct($array); } public function offsetExists($offset) { var_dump('Called: '.__METHOD__); return parent::offsetExists($offset); } public function offsetGet($offset) { var_dump('Called: '.__METHOD__); return parent::offsetGet($offset); } public function offsetSet($offset, $value) { } public function offsetUnset($offset) { } } $array = new ArrayObject(array('foo' => '')); var_dump(isset($array['foo']), empty($array['foo'])); $array = new SomeArray(array('foo' => '')); var_dump(isset($array['foo']), empty($array['foo']));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of SomeArray::offsetExists($offset) should either be compatible with ArrayObject::offsetExists(mixed $key): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/ZPuUS on line 10 Deprecated: Return type of SomeArray::offsetGet($offset) should either be compatible with ArrayObject::offsetGet(mixed $key): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/ZPuUS on line 15 Deprecated: Return type of SomeArray::offsetSet($offset, $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/ZPuUS on line 20 Deprecated: Return type of SomeArray::offsetUnset($offset) should either be compatible with ArrayObject::offsetUnset(mixed $key): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/ZPuUS on line 23 bool(true) bool(true) string(30) "Called: SomeArray::__construct" string(31) "Called: SomeArray::offsetExists" string(31) "Called: SomeArray::offsetExists" string(28) "Called: SomeArray::offsetGet" bool(true) bool(true)

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