Are there any similarities between using the & symbol in PHP function parameters and the global keyword?

When using the & symbol in PHP function parameters, it is used to pass arguments by reference, allowing the function to directly modify the original variable outside of the function scope. On the other hand, the global keyword is used to access global variables from within a function. While both mechanisms involve modifying variables outside of the function scope, they serve different purposes and should be used carefully to avoid unintended side effects.

// Using the & symbol in function parameters
function increment(&$num) {
    $num++;
}

$value = 5;
increment($value);
echo $value; // Output: 6

// Using the global keyword
$counter = 0;

function incrementCounter() {
    global $counter;
    $counter++;
}

incrementCounter();
echo $counter; // Output: 1