note 15995 modified in function.key by danbrown
| From: | danbrown@php.net | Date: | Sat, 28 Mar 2009 23:12:21 +0000 |
| Subject: | note 15995 modified in function.key by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152569@lists.php.net to get a copy of this message | ||
In the case key() does not give you back the key(myarray) but "0", try this:
(Try this example without the line containing "end($myarray)" and you see my reason for
this post...)
<?php
for($i = 0; $i <= 10; $i++) {
$myarray[] = 'content '.$i;
end($myarray);
echo ('<br>key()='.key($myarray).' , content='.$myarray[$i]);
}
?>
--was--
In the case key() does not give you back the key(myarray) but "0", try this:
(Try this example without the line containing "end($myarray)" and you see my reason for
this post...)
for($i = 0; $i <= 10; $i++) {
$myarray[] = 'content '.$i;
end($myarray);
echo ('<br>key()='.key($myarray).' , content='.$myarray[$i]);
}
http://php.net/manual/en/function.key.php