Generators in PHP
Use of generators in PHP can provide you a good memory optimisation, but if you decide to use them, there will be few more things to do.
Consider an example: you need to get data from a database, do some mapping and then return the result as XML.