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

Posted by rich on 10/19/05 09:14

In article <43556f83$1@news.broadpark.no>, Siv Hansen says...
>
>I have this array,
>$navbar_left = array(
>'Hjem'=>'index.php',
>'Borte'=>'borte.php',
>'Uavgjort'=>'uavgjort.php'
>);

Maybe try this for starters to test if you're catching all the keys in your
array and their values...

foreach ($navbar_left as $key => $value)
{
echo "Key: $key Value: $value<br>\n";
}

Once you have that down you can replace the "echo" with whatever you needed to
do with the data.

Rich
--
Newsguy - http://newsguy.com


>
>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

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