|
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?
[Back to original message]
|