All pastes #1081595 Raw Edit

Someone

public text v1 · immutable
#1081595 ·published 2008-07-24 07:29 UTC
rendered paste body
<?php

class MyArray implements ArrayAccess {
    private $real;

    public function __construct($in) { $this->real = $in; }
    public function offsetExists($offset) { }
    public function offsetGet($offset) {
        if (is_array($this->real) && isset($this->real[$offset])) return $this->real[$offset];
    }
    public function offsetSet($offset, $value) { }
    public function offsetUnset($offset) { }
}

$a = new MyArray(range(0,9));


var_dump($a[0]);