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:
25.17 ms | 404 KiB | 5 Q