What are the advantages and disadvantages of passing arrays as parameters to PHP functions?

Passing arrays as parameters to PHP functions can be advantageous as it allows for passing multiple values in a single parameter, reducing the number of arguments needed. It also allows for passing complex data structures easily. However, passing large arrays can lead to increased memory usage and potentially slower performance compared to passing individual values.

// Example of passing an array as a parameter to a PHP function
function processArray($arr) {
    foreach ($arr as $value) {
        echo $value . " ";
    }
}

$array = [1, 2, 3, 4, 5];
processArray($array);