If you have an array like this (change the url to href): $menu = array ( 'link1' => array( 'url' => 'foo', 'title' => 'bar' 'style' => 'dolor' ), 'link2' => array( 'url' => 'foo', 'title' => 'bar' 'style' => 'amet' ) );
Then something like this, or the general idea should work: $menu = array ( 'link1' => array( 'href' => 'foo', 'title' => 'bar', 'style' => 'dolor' ), 'link2' => array( 'href' => 'foo', 'title' => 'bar', 'style' => 'amet' ) ); foreach ($menu as $array) { $tag = "<a"; foreach ($array as $k => $v) { $tag .= " $k=\"$v\""; } $tag .= ">$menu</a>\n"; echo $tag; } There are better ways to do it I'm sure, but this is just following the previous example. -Shawn -----Original Message----- From: Brian V Bonini [mailto:[EMAIL PROTECTED] Sent: Saturday, January 31, 2004 8:56 AM To: Shawn McKenzie Cc: PHP Lists Subject: Re: [PHP] Re: array block On Fri, 2004-01-30 at 22:48, Shawn McKenzie wrote: > You would need to give an example of what you mean by change dynamically, > because if you can't predict the key indexes then how can you know which > ones to use in your anchor tag? say this: $menu = array ( 'link1' => array( 'url' => 'foo', 'title' => 'bar' ), 'link2' => array( 'url' => 'foo', 'title' => 'bar' ) ); were to dynamically change to this: $menu = array ( 'link1' => array( 'url' => 'foo', 'title' => 'bar' 'style' => 'dolor' ), 'link2' => array( 'url' => 'foo', 'title' => 'bar' 'style' => 'amet' ) ); I'm stretching here, have no practical use for it, and can think of much better ways to handle it but am still curious. Obviously you need to traverse the inner array which is not an issue, but I get stumped with trying to format it as in the previous examples. -- Brian GnuPG -> KeyID: 0x04A4F0DC | URL: www.gfx-design.com/keys Key Server: pgp.mit.edu ====================================================================== gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC GnuPG: http://gnupg.org http://www.biglumber.com/x/web?qs=0x2C35011004A4F0DC Linux Registered User #339825 at http://counter.li.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php