What does the line "global $variable" mean in PHP?
Using the line "global $variable" in PHP allows you to access a global variable within a function. This is necessary when you want to modify a global variable from within a function's scope. By using the "global" keyword, you can indicate that the variable being referenced is the global one, not a local variable with the same name.
$globalVar = 10;
function modifyGlobalVar() {
global $globalVar;
$globalVar += 5;
}
modifyGlobalVar();
echo $globalVar; // Output: 15