note 10418 deleted from control-structures.foreach by sniper
| From: | sniper@php.net | Date: | Wed, 08 Oct 2003 04:11:56 +0000 |
| Subject: | note 10418 deleted from control-structures.foreach by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58020@lists.php.net to get a copy of this message | ||
Note Submitter: erik at powells dot com
----
note that when you use a construct like this:
foreach($array as $key => $value)
to force hash-style interpretation (ala each() in perl), that hashes contain an index value as well,
so:
foreach($array as $key => $value) { echo "$key: $value\n"; };
ends up looking like this:
0: foo
mykey: foo
1: bar
myotherkey: bar
which is highly annoying but could also be useful for 'real' indexing.