Okay, I\'m not sure I\'m understanding this concept properly (I\'m learning PHP). If I understand correctly: Global variables can be referenced anywhere in the same document
Local variables are needed for encapsulation, which is a good practice in programming.
Global variables in fact is a bad practice, because a variable can be altered anywhere in the application, and believe me, is hard to debug why the value of a variable is not the expected if you have multiples includes with multiples includes...
If you need to use a global variable, perhaps you should consider using a singleton or pass the variable as a parameter to the functions that need it.