(PHP 5 >= 5.0.0, PHP 7)
ArrayObject::offsetGet — Returns the value at the specified index
index
The index with the value.
The value at the specified index or NULL
.
Produces an E_NOTICE
error message when the specified
index does not exist.
Example #1 ArrayObject::offsetGet() example
<?php
$arrayobj = new ArrayObject(array('zero', 7, 'example'=>'e.g.'));
var_dump($arrayobj->offsetGet(1));
var_dump($arrayobj->offsetGet('example'));
var_dump($arrayobj->offsetExists('notfound'));
?>
以上例程会输出:
int(7) string(4) "e.g." bool(false)