AnewtGenerator class

Generator class to generate sequences.

Class Overview

Generator class to generate sequences.

A generator can be used to generate strings from a sequence. This is useful for e.g. zebra-pattern row listings.

Public Methods

__construct($sequence)

Constructs a new AnewtGenerator instance.

You should pass the sequence to use, which can be an array array containing values or, alternatively, multiple parameters.

Example of using a single array:

$g = new AnewtGenerator(array('a', 'b', 'c'));

Example of using multiple parameters:

$g = new AnewtGenerator('a', 'b', 'c');

Parameters

$sequence

An array with sequence values or multiple parameters that will be used as a sequence.

next()

Returns the next value from the sequence.

Private Attributes

$sequence [private]

The sequence this AnewtGenerator iterates over.

$counter [private]

The number of times the next() method has been called.