Recursion in PHP
Learn about recursion in PHP and optimization techniques for recursive codes.
We’ve already discussed composition, functors, monads, and task parallelization. This chapter’s contents includes ideas used either in direct conjunction with said topics or concepts that accentuate their importance. Recursion, pattern-matching, and property-testing ensure that iterations are cleaner, flow-control is more concise, and quality assurance for functional programming apps is tractable, respectively.
Definition of recursion
Recursion is a pattern that features functions calling themselves. It is, in terms of effect, very similar to iteration through control structures (if/else
, do-while
, and the like), but has some unique fundamental preconditions for success. Among these conditions are:
-
A base case: The condition that causes the ...