Scope and foreach loops
One of these misunderstandings: I always thought foreach loops would create a temporary variable for the current element that would mask any variable with the same name in the current scope.
Obviously that is not the case, as I discovered when I tried to find a bug in Simple Tagging’s STP_RelatedPosts() function.
First I thought this was a PHP-only behavior… But see the following PHP and Python examples:
More »




