PHP.nl

ArrayAccess::offsetGet

ArrayAccess::offsetGet

Offset to retrieve

mixed **ArrayAccess::offsetGet** mixed $offset

Returns the value at specified offset.

This method is executed when checking if offset is . empty

offsetThe offset to retrieve.

Can return all value types.

Opmerking: > It's possible for implementations of this method to return by reference. This makes indirect modifications to the overloaded array dimensions of objects possible. ArrayAccess

  A direct modification is one that replaces completely the value of
  the array dimension, as in . An
  indirect modification, on the other hand, only changes part of the
  dimension, or attempts to assign the dimension by reference to
  another variable, as in  or
  . Increments with
   and decrements with 
  are also implemented in a way that requires indirect modification.
`$obj[6] = 7``$obj[6][7] = 7``$var =& $obj[6]``++``--`


  While direct modification triggers a call to
  , indirect modification
  triggers a call to .
  In that case, the implementation of
   must be able to return by
  reference, otherwise an  message is raised.
`ArrayAccess::offsetSet``ArrayAccess::offsetGet``ArrayAccess::offsetGet``E_NOTICE`

ArrayAccess::offsetExists

Documentatie