Sorry, $k should be $text.

foreach ($menu as $text => $array) {
 $url = $array['url'];
 $title = $array['title'];

 echo "<a href=\"$url\" title=\"$title\">$text</a>\n";
}

"Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> foreach ($menu as $text => $array) {
>  $url = $array['url'];
>  $title = $array['title'];
>
>  echo "<a href=\"$url\" title=\"$title\">$k</a>\n";
> }
>
> HTH
> -Shawn
>
> "Brian V Bonini" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I'm having array block, trying to format the data in a two dimensional
> > associative array.
> >
> > $menu = array (
> > 'link1' => array(
> > 'url' => 'foo',
> > 'title' => 'bar'
> > ),
> > 'link2' => array(
> > 'url' => 'foo',
> > 'title' => 'bar'
> > )
> > );
> >
> > foreach($menu as $k => $v) { etc..
> >
> > need to end up with
> > <a href=url title=title>link(x)</a>
> >
> > Can't seem to put this together in my head. Long day I guess.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to