The venerated foreach-loop may seem to have formed a part of PHP from the outset, but it actually entered the language starting with PHP 4, apparently appropriated from Perl. While nowadays, this control structure provides a convenient way to iterate over an array or object without the complication of conditional looping inherent in for, while, and do-while loops, it was originally intended to provide a way to easily traverse arrays (see PHP Manual published 3-6-2003). Read the rest of this entry »