3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X extends ArrayObject{ public function offsetSet($key, $val){ echo "offsetSet called \n"; parent::offsetSet($key, $val); } } $arr = new X([]); $arr->append('val'); $arr->offsetSet(5, 'val'); $arr->append('app'); print_r($arr);

preferences:
26.31 ms | 402 KiB | 5 Q