In a new posting from Harry Fueck's weblog on SitePoint, he continues on the foundation from Lazy PHP: Part 1 to show another method for evaluating your data: Lazy Evaluation.
Lazy Evaluation is a method to look at the data and understand that some of it just doesn't need to be evaluated. It is also useful for recursively defining infinite data structures. Since each level of recursion is evaluated only as it is needed, data is only generated as it is consumed and the evaluation of the data structure can terminate when the consumption is completed.
With the examples hiw gives (Variable Functions and Lambda Functions), you can get a good idea where this functionality. Simply by defining functions a little bit differently and using some of PHP's handy built-in variable variable functionality, you can not only make cleaner scripts, but maybe even gain some speed as well...




