Reputation: 12904
Do PHP5.3 have any known bug issue that makes non static variables in scope behave Static ? I donno why in a if{}Scope I've
{
echo $_not_static;
$_not_static = 5;
}
First Time it fires E_NOTICE as it should But second time it prints 5. I was Struggling with this for 3+ hours but not getting any hint of a fault from my side.
Upvotes: 1
Views: 182
Reputation: 24182
Variables are function-scoped, regardless on the block they are in, and that's in any PHP version. If you declare a variable inside an if block, and you enter there, it will stay declared after the if finishes, for the entire function scope.
Upvotes: 4