December 2016
Beginner to intermediate
238 pages
6h 10m
English
© Kelt Dockins 2017
Kelt Dockins, Design Patterns in PHP and Laravel, 10.1007/978-1-4842-2451-9_19
Kelt Dockins1
(1)Dolph, Arkansas, USA
$> git checkout iteratorProvide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.1
What is an aggregate object? The word aggregate means a whole formed by combining several elements. In programming terms, it’s a collection, array, list, etc. Why use an aggregate object, though? You can already aggregate a bunch of numbers, strings, or objects all sequentially using arrays. Why do you need the iterator pattern? Is this a useless pattern? The answer is no.
There are some benefits you gain from using an iterator object. ...
Read now
Unlock full access