Something to be more generally aware of, of which this is a symptom, is that unlike C/C++ etc, PHP conditional statements do not define a scope at all (only functions have their own scope in PHP).
In C a variable declared in the control statement conditional itself remains in scope for all subsequent blocks of the same control statement (i.e. all subsequent elses of an if)... whereas in PHP not even variables inside the blocks will go out of scope :D
Something to be more generally aware of, of which this is a symptom, is that unlike C/C++ etc, PHP conditional statements do not define a scope at all (only functions have their own scope in PHP).
if (true) { $declared_in_if = "Hello world"; } echo $declared_in_if; // outputs "Hello world"In C a variable declared in the control statement conditional itself remains in scope for all subsequent blocks of the same control statement (i.e. all subsequent elses of an if)... whereas in PHP not even variables inside the blocks will go out of scope :D