IteratorTrait
A generic implementation of the Iterator interface.
Tags
Table of Contents
Properties
- $data : TData
- Holds the iterable data.
Methods
- current() : TValue|false
- Return the current item.
- key() : TKey|null
- Return the current key.
- next() : void
- Move forward to next item.
- prev() : void
- Move back to previous item.
- rewind() : void
- Rewind the iterator to the first item.
- valid() : bool
- Check if current position is valid.
Properties
$data
Holds the iterable data.
protected
TData
$data
= []
Methods
current()
Return the current item.
public
current() : TValue|false
APIYes
Return values
TValue|false —The current item or FALSE if invalid
key()
Return the current key.
public
key() : TKey|null
APIYes
Return values
TKey|null —The current key or NULL if invalid
next()
Move forward to next item.
public
next() : void
APIYes
prev()
Move back to previous item.
public
prev() : void
APIYes
rewind()
Rewind the iterator to the first item.
public
rewind() : void
APIYes
valid()
Check if current position is valid.
public
valid() : bool
APIYes
Return values
bool —Whether the current position is valid