note 10975 modified in key by zak
| From: | zak@php.net | Date: | Fri, 13 Jul 2001 03:15:04 +0000 |
| Subject: | note 10975 modified in key by zak | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15308@lists.php.net to get a copy of this message | ||
[Editor's Note:
Use the strict comparison operator to differentiate between FALSE and 0
i.e. while ( FALSE !== ($key = key ($myArray))) {
// do some job
}
--zak@php.net]
Sometimes, the first key of an associative array is numeric zero(or null). Then you can't use
key as the following because the very first cycle of the loop cannot be accomplished.
while ( $key = key( $myArray ) ) {
// do some job
}
So be careful...
http://www.php.net/manual/en/key.php