-----Original Message----- From: Tedd Sperling [mailto:tedd@xxxxxxxxxxxx] Sent: Thursday, May 31, 2012 1:01 PM To: php-general General Cc: Tristan Subject: Re: [foreach] - is it proper to... 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 But don't forget, the first scenario would be bad coding practice; you are mutating the array $entry. It will become the last value of the array you are foreach'ing. $entry begins as an array, and ends as a string. As a result, I'd suggest to stay away from it. The second scenario, $ entries remains an array, and $entry a string. Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php