Skip to main content


Showing posts from March, 2011

if x, foreach x

Here's another winner I found in actual (PHP) code that I was working on: if ($groups) { foreach($groups as $group) { /* ... */ } } Good thing they wrapped that foreach loop in that if , eh? We wouldn't have wanted to waste time looping through the whole ( empty ) array, if the array were empty in the first place, now would we?? :-D