Since recursion is the process when a function calls itself, we can have a valid question in mind such as "how deep can we go with this recursion?". Let's do a small program for this:
function maxDepth() {
static $i = 0;
print ++$i . "\n";
maxDepth();
}
maxDepth();
Can we guess the max depth level? The depth reached 917,056 levels before exhausting the memory limit. If XDebug is enabled, then the limit will be much less compared to this. It also depends on your memory, OS, and PHP settings such as memory limit and max execution time.
Though we have the option to go very deep with our recursion, it is always important to remember that we must have control with our recursive function. We should know the base conditions and where the recursion must end. Otherwise, it might create some wrong results or end abruptly...