3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test1 extends ArrayObject { } class Test2 extends ArrayObject { function offsetGet($key) { return parent::offsetGet($key); } } $t1 = new Test1(); $t1['huba'] = array('one','two'); $t1['huba'][] = 'three'; print_r($t1); $t2 = new Test2(); $t2['huba'] = array('one','two'); $t2['huba'][] = 'three'; print_r($t2);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of Test2::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/pE9WP on line 7 Test1 Object ( [storage:ArrayObject:private] => Array ( [huba] => Array ( [0] => one [1] => two [2] => three ) ) ) Notice: Indirect modification of overloaded element of Test2 has no effect in /in/pE9WP on line 17 Test2 Object ( [storage:ArrayObject:private] => Array ( [huba] => Array ( [0] => one [1] => two ) ) )

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.08 ms | 403 KiB | 8 Q