SessionIterator
API reference › yii › web › SessionIterator
SessionIterator implements an iterator for traversing session variables managed by Session.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Constructor. | SessionIterator |
current() | Returns the current array element. | SessionIterator |
key() | Returns the key of the current array element. | SessionIterator |
next() | Moves the internal pointer to the next array element. | SessionIterator |
rewind() | Rewinds internal array pointer. | SessionIterator |
valid() | Returns whether there is an element at current position. | SessionIterator |
Method details
Section titled “Method details”current()
Section titled “current() ”public function current(): mixedReturns the current array element.
This method is required by the interface Iterator.
Returns
mixed: The current array element
key()
Section titled “key() ”public function key(): string|int|nullReturns the key of the current array element.
This method is required by the interface Iterator.
Returns
string|int|null: The key of the current array element
next()
Section titled “next() ”public function next(): mixedMoves the internal pointer to the next array element.
This method is required by the interface Iterator.
Returns
mixed
rewind()
Section titled “rewind() ”public function rewind(): mixedRewinds internal array pointer.
This method is required by the interface Iterator.
Returns
mixed
valid()
Section titled “valid() ”public function valid(): boolReturns whether there is an element at current position.
This method is required by the interface Iterator.
Returns
bool