If Statement Variable Scope In PHP
Apr 16
Variable scope is the context within your code in which a variable is defined and able to accessed. If you try to access a variable that is out of scope, the variable will be undefined and you will not get the results you are expecting.
In PHP, variables all exist withing the same when your code is inline or included in an include or require statement. The exception to this rule is that classes and functions have their own variable scope. If statements, however, do not have their own variable scope.
Read More


