(PHP 5 >= 5.0.0, PHP 7)
Returns the value at the specified index
public mixed ArrayObject::offsetGet ( mixed $index )
Parameters:
index
The index with the value.
Returns:
The value at the specified index or NULL
.
Exception:
Produces an E_NOTICE
error message when the specified index does not exist.
Examples:
ArrayObject::offsetGet() example
1 2 3 4 5 6 | <?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' )); ?> |
The above example will output:
int(7) string(4) "e.g." bool(false)
Please login to continue.