3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyStuff extends ArrayObject { function offsetGet($offset) { echo "Called"; return parent::offsetGet($offset); } } $array = array('foo' => 42); $array_object = new MyStuff($array); var_dump(isset($array['foo'])); //true var_dump(empty($array['foo'])); //false var_dump(isset($array_object['foo'])); //should be true (offsetGet not called) var_dump(empty($array_object['foo'])); //should be false (offsetGet called)
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of MyStuff::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/p8RZ9 on line 5 bool(true) bool(false) bool(true) Calledbool(false)

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:
41.21 ms | 401 KiB | 8 Q