Sinsing and your interpretation of PHP recursion
In fact, recursion into other programming languages may be a beginner's function of an exercise, but because of the particularity of PHP, we take it out specifically to explain, first of all, what is recursion, I first know recursion is to find a number of factorial, such as we write a function, and then ask its factorial is how much.
Look at the following PHP code:
0) {return $n *xin ($n-1);} Else{return 1;}} Echo Xin (4);Its output is of course 24, what do you mean, very simple, we give a value to the Xin function, if it is larger than 0, then use it to multiply the result of calling $n-1 's Xin function, of course, the reader may have n ways to calculate the factorial of n calculation, but undoubtedly, this is a recursive calculation.
As can be seen, the recursion in PHP is very similar to high school learning mathematical induction, the principle is very simple and understandable. Its approximate step is to first determine whether the need to recursive, if so, give a rule, if not, need to return in a timely manner, give control to its callers, the basic principle is so much, there is something to write here first.