What are common mistakes to avoid when passing arrays as parameters in PHP functions?

Common mistakes to avoid when passing arrays as parameters in PHP functions include not checking if the parameter is an array before operating on it, assuming the array will always have certain keys or values, and not handling cases where the array parameter is missing or null. To avoid these mistakes, always check if the parameter is an array before using it, validate the array's structure if necessary, and handle cases where the array parameter is not provided or is null.

function processArray(array $arr) {
    if (empty($arr)) {
        return;
    }

    // Perform operations on the array
}

// Call the function with an array parameter
$array = [1, 2, 3];
processArray($array);