Re: array block
| From: | Shawn McKenzie | Date: | Fri, 30 Jan 2004 23:45:02 +0000 |
| Subject: | Re: array block | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-176418@lists.php.net to get a copy of this message | ||
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" <b-bonini@cox.net> wrote in message
news:1075505086.17652.10.camel@home.gfx-design.com...
> 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.