ArrayAccess::offsetGet

(PHP 5, PHP 7)

ArrayAccess::offsetGet锟斤拷取一锟斤拷偏锟斤拷位锟矫碉拷值

说锟斤拷

abstract public ArrayAccess::offsetGet ( mixed $offset ) : mixed

锟斤拷锟斤拷指锟斤拷偏锟斤拷位锟矫碉拷值锟斤拷

锟斤拷锟斤拷锟揭伙拷锟狡拷锟轿伙拷锟斤拷欠锟轿� empty() 时锟斤拷锟剿凤拷锟斤拷锟斤拷执锟叫★拷

锟斤拷锟斤拷

offset

锟斤拷要锟斤拷取锟斤拷偏锟斤拷位锟矫★拷

注锟斤拷

Note:

Starting with PHP 5.3.4, the prototype checks were relaxed and it's possible for implementations of this method to return by reference. This makes indirect modifications to the overloaded array dimensions of ArrayAccess objects 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] = 7 or $var =& $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 to ArrayAccess::offsetGet(). In that case, the implementation of ArrayAccess::offsetGet() must be able to return by reference, otherwise an E_NOTICE message is raised.

锟斤拷锟斤拷值

锟缴凤拷锟斤拷锟轿猴拷锟斤拷锟酵★拷

锟轿硷拷