The Sequence object

If you need to manipulate multiple Period instances you can now manage them easily using the provided Sequence class. This class is a List similar to an array that uses incremental integer keys.

The Sequence class is introduced in version 4.1.

The constructor


public Sequence::__construct(Period ...$intervals)

Instantiate a new Sequence object with the given intervals.


use League\Period\Sequence;
use League\Period\Period;

$sequence = new Sequence(
    new Period('2018-01-01', '2018-01-31'),
    new Period('2018-02-10', '2018-02-20'),
    new Period('2018-03-01', '2018-03-31'),
    new Period('2018-01-20', '2018-03-10')

Once instantiated, you can use the Sequence object: