Back to the Learning!

Laracasts is packed full with over 1,000 lessons just like this one.

Sign up to get full access or log in to your account and sit back.

Published On Jul. 15th 2016

How Do I: How Do I Use Iterators

Episode 3 Run Time 17:07

Download

"Iterator" is a scary term, but it's not so hard to understand. You already know that you can iterate (with foreach) over an array. But what about things which are not arrays? Maybe you're dealing with a collection class, or a file reader, or a database query. How do we iterate over these sorts of things? Well, easily!

View the source for this lesson on GitHub.

Thanks so much to Jigal Sanders for the question. If the rest of you have any questions that could be answered in video-form, tweet your question and add the hash tag, #helpMeLaracasts.