- When is it best to use Iterators in PHP, and how can they be implemented to best avoid loading all objects into memory simultaneously?
- Do any constructs exist in PHP so that we can queue up results of an operation for use with an Iterator, while again avoiding loading all objects into memory simultaneously?
- An example would be a curl HTTP request against a REST server
- In the case of an HTTP request that returns all results at once (a la curl), would we be better off to go with streaming results, and if so, are there any limitations or pitfalls to be aware of?
- If using streaming, is it better to replace curl with a PHP native stream/socket?
My intention is to implement Iterators for a REST client, and separately a document ORM that I'm maintaining, but only if I can do so while gaining benefits from reduced memory usage, increased performance, etc. Thanks in advance for any responses :-)