RE: [PHP] Re: Arrays
| From: | Martin Towell | Date: | Tue, 11 Jun 2002 01:43:55 +0000 |
| Subject: | RE: [PHP] Re: Arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-101487@lists.php.net to get a copy of this message | ||
use ".=" instead of "="
$echo .= "<li><a href='". $link ."'>". $name
."</a></li><br>";
(remember to initialise $echo = "" somewhere first just in case is contains
something from elsewhere)
-----Original Message-----
From: Dan [mailto:danielb@siliconblue.com]
Sent: Tuesday, June 11, 2002 11:36 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Arrays
I have figured out how to do it thanks for you guys help..
Just one thing...
<?
$contact = array( 'moreinfo.php' => 'More Info'
, 'contact.php' => 'Contact Us'
, 'apage.php' => 'A Page'
);
foreach ($contact as $link => $name)
{
echo "<li><a href='". $link ."'>". $name
."</a></li><br>";
}
?>
What I need to do now is in the echo string is make use something like:
$echo = "<li><a href='". $link ."'>". $name
."</a></li><br>";
I have tryed doing it this way but it will only desplay one array when I
call $echo down the page.
What can I do to desplay all of them?
"Dan" <danielb@siliconblue.com> wrote in message
news:20020610220459.43425.qmail@pb1.pair.com...
> I'm trying to get my head around arrays and how to munipulate them.
>
> what I need to do is add html around the arrays eg.
> <li><a
> href='".$link(0)."'>".$name."</a></li>;
>
> I have my head around that but I the number of lines the I need to create
is
> going to change so I need the script to repeat untill all the arrays are
> used.
>
> --
> -----------------------------------------
> Daniel Broome, siliconBLUE Ltd, Web Author,
> http://siliconblue.com
> Mob: 64-21-178-5120
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php