ArrayObject
PHP 手册

ArrayObject::offsetGet

(PHP 5 >= 5.0.0)

ArrayObject::offsetGetReturns the value at the specified index

说明

public mixed ArrayObject::offsetGet ( mixed $index )

参数

index

The index with the value.

返回值

The value at the specified index or NULL.

范例

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)


ArrayObject
PHP 手册