You are here: Re: assosiativ array « All PHP « IT news, forums, messages
Re: assosiativ array

Posted by James Blews on 10/19/05 07:08

while(list($key,$value)=each($navbar_left))
{

//$key is the assoc. key name
//$value is the assoc. array value to that key

}

Hope it helps,
Jim

"Siv Hansen" <sivh@broadpark.no> wrote in message
news:43556f83$1@news.broadpark.no...
>I have this array,
> $navbar_left = array(
> 'Hjem'=>'index.php',
> 'Borte'=>'borte.php',
> 'Uavgjort'=>'uavgjort.php'
> );
>
> I want to loop through it, but don't know how.
> I've tried
> foreach($navbar_left as $navbar){
> foreach($navbar as $key=>$value){
> // do something funny
> }
> }
>
> and
> foreach($navbar_left as $navbar){
> // do funny stuff
> }
> and
> foreach($navbar_left as $key=>$value){
> // do funny stuff
> }
>
> None working, keep getting Warning: Invalid argument supplied for
> foreach() in c:\wamp\www\cenit_web\index.php on line 14
>
> anyone?

 

Navigation:

[Reply to this 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

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