What are the potential issues that may arise when trying to call a function within itself in PHP, and how can they be resolved?

One potential issue that may arise when trying to call a function within itself in PHP is infinite recursion, where the function calls itself indefinitely, leading to a stack overflow error. This can be resolved by adding a base case or condition to terminate the recursive calls.

function recursiveFunction($n) {
    // Base case to terminate recursion
    if($n <= 0) {
        return;
    }
    
    // Recursive call
    recursiveFunction($n - 1);
    
    // Other function logic here
}