Since: 5.5

class IntlIterator implements Iterator (View source)

This class represents iterator objects throughout the intl extension whenever the iterator cannot be identified with any other object provided by the extension. The distinct iterator object used internally by the foreach construct can only be obtained (in the relevant part here) from objects, so objects of this class serve the purpose of providing the hook through which this internal object can be obtained. As a convenience, this class also implements the Iterator interface, allowing the collection of values to be navigated using the methods defined in that interface. Both these methods and the internal iterator objects provided to foreach are backed by the same state (e.g. the position of the iterator and its current value).

Subclasses may provide richer functionality.

Methods

mixed
current()

Get the current element

mixed
key()

Get the current key

void
next()

Move forward to the next element

void
rewind()

Rewind the iterator to the first element

bool
valid()

Check if current position is valid

Details

mixed current()

Get the current element

Return Value

mixed

Can return any type.

mixed key()

Get the current key

Return Value

mixed

TKey on success, or null on failure.

void next()

Move forward to the next element

Return Value

void

Any returned value is ignored.

void rewind()

Rewind the iterator to the first element

Return Value

void

Any returned value is ignored.

bool valid()

Check if current position is valid

Return Value

bool

The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.