3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myobject extends ArrayObject { public function &offsetGet($key) { $var &= parent::offsetGet($key); var_dump($var); return $var; } } $obj1 = new myobject(array(array(1,2,3), 1)); var_dump($obj1); unset($obj1[0][0]); var_dump($obj1);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of & myobject::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/e5CjJ on line 3 object(myobject)#1 (1) { ["storage":"ArrayObject":private]=> array(2) { [0]=> array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } [1]=> int(1) } } Warning: Undefined variable $var in /in/e5CjJ on line 4 Notice: Indirect modification of overloaded element of myobject has no effect in /in/e5CjJ on line 12 Fatal error: Uncaught TypeError: Unsupported operand types: null & array in /in/e5CjJ:4 Stack trace: #0 /in/e5CjJ(12): myobject->offsetGet(0) #1 {main} thrown in /in/e5CjJ on line 4
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:
36.41 ms | 402 KiB | 8 Q