How can one effectively use the global keyword in PHP to access variables outside of a function scope?
When you want to access variables defined outside of a function within the function scope in PHP, you can use the `global` keyword. This keyword allows you to specify that a variable is from the global scope, rather than creating a new local variable with the same name. By using `global`, you can modify the global variable's value from within the function.
$globalVar = 10;
function updateGlobalVar() {
global $globalVar;
$globalVar = 20;
}
updateGlobalVar();
echo $globalVar; // Output will be 20