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

Posted by Ed on 10/19/05 09:04

Siv Hansen wrote:
> 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.

Hi there,

Try the following...

foreach ($navbar_left as $key => $value) {
// For example purposes...
echo '<a href="'.$value.'">'.$key.'</a><br />';
}

If you get an 'Invalid argument' error, there is nothing in the array to
loop through. In that case, check the contents of the array - print_r()
function.

Good luck,

Ed

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

 

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

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