Index Documentation

ArrayIterator
in package
implements Iterator

Provides an Iterator implementation for normal arrays.

Table of Contents

Interfaces

Iterator

Methods

__construct()  : mixed
current()  : mixed
Returns the current element.
key()  : mixed
Returns the key of the current element.
next()  : void
Moves forward to next element.
rewind()  : void
Rewind the Iterator to the first element.
valid()  : bool
Checks if current position is valid.

Methods

__construct()

public __construct(array<string|int, mixed> $array) : mixed
Parameters
$array : array<string|int, mixed>

Array to iterate upon.

current()

Returns the current element.

public current() : mixed
Return values
mixed

Can return any type.

key()

Returns the key of the current element.

public key() : mixed
Return values
mixed

Returns scalar on success, or null on failure.

rewind()

Rewind the Iterator to the first element.

public rewind() : void

valid()

Checks if current position is valid.

public valid() : bool
Return values
bool

Returns true on success or false on failure.


        
On this page

Search results