Re: Question on foreach()?

From: Date: Fri, 14 Jul 2000 16:21:59 +0000
Subject: Re: Question on foreach()?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-24551@lists.php.net to get a copy of this message
Most of my foreach loops are run on database queries as obtained from *_fetch_array(), so they have both numerical and string indices, but I try to get my programmers to use strings bcz we always know what the column name is, while we don't always know in which order things will be returned. Regardless of whether the array is string or numerical indexed (hmm...bad English there), it is hard to get the current key given the array and the current value, whilst the current value is readily available given the array and the current key. All that was leading up to this: Would there be opposition to adding some kind of syntax that let allowed for getting the key instead of the value? Or is this one of those "there's no Right Way (tm) to do it" issues? I would be more than glad to take it on (with the usual amount of annoyance to the Core...). I'm assuming that this would actually be work in Zend, which is still a mystery to me... On Fri, 14 Jul 2000, Andrei Zmievski wrote the following to Joey Smith : > On Fri, 14 Jul 2000, Joey Smith wrote: > > Andrei: > > Thanks. I courteously disagree, but thank you for answering the > > question. =) > > No, seriously, most of the arrays I use, at least, don't have string > keys. > > -Andrei > * Gun manufacturers don't make bad products, bad parents do. * >

« previous php.dev (#24551) next »