3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Ints extends ArrayObject { public function offsetGet($index) : int { var_dump('offsetGet'); return parent::offsetGet($index); } } $ints = new Ints([1,2,'foo']); for ($i = 0; $i < 3; $i++) { var_dump($ints[$i]); }

preferences:
58.18 ms | 402 KiB | 5 Q