How can you pass an array to a function in PHP?

To pass an array to a function in PHP, you can simply include the array as an argument when calling the function. The function definition should specify the parameter as an array type. This allows you to access and manipulate the array within the function.

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

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