PDA

View Full Version : Displaying an array



alexjewell
07-24-2006, 05:50 AM
I'm working on a weblog, and currently, more specifically, the archives. I have an array for the posts for each year, and I want to easily get them on the archives page. Here's an example array, for 2006:


$posts_2006 = array ( 1 =>
"<li><a href=\"view.php?page=april102006\">April 10, 2006</a> - AIM screen name dilemma.</li>\n",
"<li><a href=\"view.php?page=january32006\">January 3, 2006</a> - Flickr photography site.</li>\n");

Can I just echo $posts_2006, and the whole array will show up as code, like so:

<li><a href="view.php....
<li><a href="view.php...

etc?

Or do I have to echo each individual thing, as so:

$posts_2006[1]
$posts_2006[2]

...etc?

Help!

Twey
07-24-2006, 02:40 PM
echo(implode('', $posts_2006));