Skip to content
PHP Ecosystem
Explore

SessionIterator

API reference › yii › web › SessionIterator

classyii\web\SessionIterator
ImplementsIterator
Since2.0
Sourceframework/web/SessionIterator.php

SessionIterator implements an iterator for traversing session variables managed by Session.

MethodDescriptionDefined 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
public function __construct()

Constructor.

public function current(): mixed

Returns the current array element.

This method is required by the interface Iterator.

Returns

mixed: The current array element

public function key(): string|int|null

Returns 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

public function next(): mixed

Moves the internal pointer to the next array element.

This method is required by the interface Iterator.

Returns

mixed

public function rewind(): mixed

Rewinds internal array pointer.

This method is required by the interface Iterator.

Returns

mixed

public function valid(): bool

Returns whether there is an element at current position.

This method is required by the interface Iterator.

Returns

bool