Re: Question on foreach()?

From: Date: Fri, 14 Jul 2000 16:30:00 +0000
Subject: Re: Question on foreach()?
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-24556@lists.php.net to get a copy of this message
Hi Joey! On Fri, 14 Jul 2000, Joey Smith wrote: > 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. least mysql_fetch_array() allows for `MYSQL_ASSOC, MYSQL_NUM, and MYSQL_BOTH' to select the array type. > 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 foreach (array_keys($arr) as $k) { walk_over_keys; } -- teodor

« previous php.dev (#24556) next »