Reference: What is variable scope, which variables are accessible from where and what are “undefined variable” errors?
What is “variable scope”? Variables have a limited “scope”, or “places from which they are accessible”. Just because you wrote $foo = ‘bar’; once somewhere in your application doesn’t mean you can refer to $foo from everywhere else inside the application. The variable $foo has a certain scope within which it is valid and only … Read more