ArrayObject
PHP Manual

ArrayObject::offsetGet

(PHP 5 >= 5.0.0, PHP 7)

ArrayObject::offsetGetReturns the value at the specified index

Descrierea

public mixed ArrayObject::offsetGet ( mixed $index )

Parametri

index

The index with the value.

Valorile întoarse

The value at the specified index or NULL.

Erori/Excepții

Produces an E_NOTICE error message when the specified index does not exist.

Exemple

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'));
?>

Exemplul de mai sus va afișa:

int(7)
string(4) "e.g."
bool(false)


ArrayObject
PHP Manual