Posted by meltedown on 11/15/77 11:23
meltedown wrote:
> According to the manual, key() returns the index element of the current
> array position.
>
> I have an array
> Array
> (
> [7857] => Soaps
> [7861] => Sponges
> [7863] => Bath Brushes
> [7858] => Toothpastes
> [7865] => Colognes
> [7960] => Miscellaneous
> )
>
>
> When I go
> $pline=key($plines);
> I get nothing for $pline.
>
> What is going on ?
> Is it possible that the array does not have a current array position ?
What I'm trying to do is get the first index in the array.
The only way is something like:
foreach($plines as $p){
$pline=key($plines);break;
}
Is there a better way ?
[Back to original message]
|