How does the "global" command work in PHP and what impact does it have on variable scope?

The "global" command in PHP allows you to access a variable from the global scope within a function. This means that you can use a variable declared outside of a function inside the function without having to pass it as a parameter. However, using "global" can make your code less modular and harder to debug, as it introduces dependencies on variables from outside the function's scope.

$globalVariable = 10;

function myFunction() {
    global $globalVariable;
    echo $globalVariable;
}

myFunction(); // Output: 10