Reply to Re: Key()

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация