ArrayObject::offsetGet

(PHP 5, PHP 7)

ArrayObject::offsetGetReturns the value at the specified index

说锟斤拷

public ArrayObject::offsetGet ( mixed $index ) : mixed

锟斤拷锟斤拷

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)