FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How best to print an array to table?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How best to print an array to table? [message #178252 is a reply to message #178251] Thu, 24 May 2012 22:51 Go to previous messageGo to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(richard)

> Ok so here's the quick and dirt simple code:
>
> <?php
>
> $Alist=array (
>
> "cover"=>"images/A/A001.jpg",
> "aname"=>"The A Team",
> "bname"=>"An Empty Glass",
> "artist"=>"SSgt Barry Sadler",
> "avideo"=>"A",
> "bvideo"=>"b",
> "label1"=>"[US] RCA Victor",
> "label2"=>"UK] RCA",
> "adate"=>"4-23-66"
> );
>
> print "<table border='1'>";
> print "<tr>";
> print "<td>hello</td>";
> print "</tr>";
> print "</table>";
>
> ?>
>
> I want to replace "hello" with $Alist "aname".
> How is that done correctly in this instance?

print "<td>{$Alist['aname']}</td>";

Curly syntax
http://www.php.net/manual/en/language.types.string.php#language.types.strin g.parsing.complex

Micha

--
http://mfesser.de/blickwinkel
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem setting Date field in MySQL
Next Topic: What is this attack trying to do?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 09:00:43 GMT 2024

Total time taken to generate the page: 0.04267 seconds