May 2017
Intermediate to advanced
340 pages
8h 16m
English
So far, we have seen that we can traverse each node of the linked list using a while loop inside the methods. What if we need to iterate from outside using just the linked list object? It is very much possible to achieve this. PHP has a very intuitive iterator interface that allows any external iterators to iterate through an object internally. The Iterator interface provides the following methods:
We will now implement these methods in our LinkedList class to make our object iterate through ...
Read now
Unlock full access