offsetget
ArrayAccess::offsetGet
Offset to retrieve
ENTITY
public
mixed
ArrayAccess::offsetGet
mixed
offset
Returns the value at specified offset.
This method is executed when checking if offset is empty.
ENTITY
offset
The offset to retrieve.
ENTITY
Can return all value types.
ENTITY
[!NOTE] It's possible for implementations of this method to return by reference. This makes indirect modifications to the overloaded array dimensions of
ArrayAccessobjects possible.A direct modification is one that replaces completely the value of the array dimension, as in
$obj[6] = 7. 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$obj[6][7] = 7or$var =ENTITY $obj[6]. Increments with++and decrements with--are also implemented in a way that requires indirect modification.While direct modification triggers a call to
ArrayAccess::offsetSet, indirect modification triggers a call toArrayAccess::offsetGet. In that case, the implementation ofArrayAccess::offsetGetmust be able to return by reference, otherwise anE_NOTICEmessage is raised.
ENTITY
ArrayAccess::offsetExists
谢谢你的反馈!