- test2: documentation ( source)
<?php
class MyArrayAccess implements \ArrayAccess
{
public function offsetExists($offset) { }
public function offsetSet($offset, $value) { }
public function offsetGet($offset) { }
public function offsetUnset($offset) { }
}
function test(array $arr)
{
echo "test";
}
function test2(\ArrayAccess $arr)
{
echo "test2";
}
$arrObj = new MyArrayAccess();
test2($arrObj);