Question on foreach()?
| From: | Joey Smith | Date: | Fri, 14 Jul 2000 07:21:11 +0000 |
| Subject: | Question on foreach()? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-24504@lists.php.net to get a copy of this message | ||
I'm just curious as to why it was decided to implement foreach as:
foreach($array as $value)
instead of
foreach($array as $key)?
It seems to me that the latter is the more logical, since $value is
available as $array[$key], while there is no (AFAIK) easy way to obtain
$key given $array and $value.
I'm not complaining, just looking to understand.