Re: Foreach

From: Date: Wed, 23 Jan 2008 13:02:13 +0000
Subject: Re: Foreach
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-267900@lists.php.net to get a copy of this message
On Jan 23, 2008 12:58 AM, Nathan Nobbe <quickshiftin@gmail.com> wrote: > On Jan 18, 2008 5:24 PM, Richard Lynch <ceo@l-i-e.com> wrote: > > > If you are trying to keep the names and orders in "parallel" you need > > to do something not unlike: > > > > while (list($key, $name) = each($names)){ > > $order = $orders[$key]; > > $query = "update whatever set order = $order where name = '$name'"; > > } > > > just as a mention; spl has a DualIterator class that would be perfect for > this > situation. i hesitate to mention it though, since ive not found it in any > php > version. its there in the doc, but not in actual php; what a shame. > http://www.php.net/~helly/php/ext/spl/classDualIterator.html > > i can only expect well see it in a subsequent version; that there is a > reason > its not yet made it.. > > -nathan > Maybe someday SPL will become part of the PHP manual too. ;)

« previous php.general (#267900) next »