On May 31, 2012, at 12:48 PM, Tristan wrote: > I'm using Zend Studio and it had a suggestion that I do a foreach as such > > foreach($entry as $entry){ > > } > > instead of > > foreach($entries as $entry){ > > } > > they both seem to work but, from a readability standpoint and just makes > more sense to me to use method 2. Is it bad practice to go with the 1st > method of coding or preferred? > > Thanks, T Let's look at that. In the first case you're doing a foreach loop on an array entitled $entry (single) using a variable entitled the same name representing the values in each element of the array -- that doesn't make sense even if it works or is recommended by Zend Studio. That would be a hell of a bug to find. In the second case, I find the syntax more correct. You are doing a foreach loop on an array entitled $entries (plural) using the values contained in the array as $entry (single) -- that makes much more sense to me. My $0.02 Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php