What are some best practices for handling variable reference parameters in PHP functions?

When passing variables by reference in PHP functions, it is important to use the '&' symbol before the parameter name in both the function definition and the function call. This allows changes made to the variable within the function to be reflected outside of the function scope. Additionally, it is good practice to clearly document in the function definition that the parameter is passed by reference.

// Function definition with variable passed by reference
function updateValue(&$value) {
    $value = $value * 2;
}

// Variable to be passed by reference
$num = 5;

// Call the function with the variable passed by reference
updateValue($num);

// Output the updated value
echo $num; // Output: 10