What is the best way to handle recursive function calls in PHP when passing arrays as arguments?

When passing arrays as arguments in recursive function calls in PHP, it's important to make sure that the array is passed by reference to avoid creating unnecessary copies of the array. This can help improve performance and memory usage when dealing with large arrays in recursive functions. To pass an array by reference in PHP, you can use the `&` symbol before the parameter name in the function definition.

function recursiveFunction(&$array) {
    // Base case
    if (condition) {
        return something;
    }
    
    // Recursive case
    foreach ($array as &$value) {
        recursiveFunction($value);
    }
}