|
Posted by jerrygarciuh on 06/10/05 00:54
Andy,
Thanks for the reply. Am I using this incorrectly?
$ary = array('a','b','c','d');
while ($x = array_shift($ary)) {
echo key($ary) . ',';
}
// output is 0,0,0
$ary = array('a' => 'apple','b' => 'bear','c' => 'cat','d' => 'dog');
while ($a = array_shift($ary)) {
echo key($ary) . ',';
}
// output is b,c,d
It seems to only work (as advertised in docs) on associative arrays.
TIA for any help,
jg
"Andy Hassall" <andy@andyh.co.uk> wrote in message
news:h0bha11cj8tn5c7gg43tvska82ul7fl4p8@4ax.com...
> On Thu, 9 Jun 2005 15:47:19 -0500, "jerrygarciuh"
> <designs@no.spam.nolaflash.com> wrote:
>
>>In reading through the list of array-related functions I did not find on
>>which returns the numeric index where the array's internal pointer
>>currently
>>sits. Is there such a function?
>
> http://uk.php.net/manual/en/function.key.php
>
> --
> Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Navigation:
[Reply to this message]
|