On 2013-09-03 3:51, David Deutsch wrote:

In this instance, I simply think that the code is easier to read. Just for reference, the difference is between:

foreach ((array)$rcmail->config->get('identity_select_headers', array()) as $header) {

and

$headers = (array) $rcmail->config->get('identity_select_headers', array())

foreach ($headers as $header) {
 
I don't have a horse in this race, but just fwiw, I don't find the former difficult to read at all. It _might_ be a code smell, but it wouldn't bother me unless I saw it a lot (i.e., the whole code base was really unnecessarily dense).
 
When I see that line, I see a "foreach", and I immediately skip to the "as", and as long as that is a sensibly-named variable, then I understand what's going on: "oh, ok, we're iterating over an array of headers, sure." I wouldn't even look very hard at the line noise, unless I was chasing down a bug that might be living in it.
 
I've been programming for about 25 years -- lots of things in code irritate me, but this isn't one of them.
 
hth, hand.
 
- R.

---
[__ Robert Sheldon [__ No Problem [__ Information technology support and services [__ (530) 575-0278