How can developers ensure that functions in PHP do not inadvertently overwrite global variables from other functions?

To prevent functions in PHP from inadvertently overwriting global variables from other functions, developers can use the `global` keyword within the function to explicitly reference the global variable. This ensures that the function accesses the global variable instead of creating a new local variable with the same name.

$globalVar = "I am a global variable";

function myFunction() {
    global $globalVar;
    $globalVar = "I am a modified global variable";
}

myFunction();

echo $globalVar; // Output: I am a modified global variable