Jump to content

Implode An Array Into


brown2005

Recommended Posts

Huh? Is this what you mean?

 

echo "<a href=\"\">" . implode("<br />\n",array_keys($comments)) . "</a>"

 

that is the idea, so each keyword that comes from the implode is wrapped in the <a></a> tags

 

tried your code above but that does not work causes a server error

If you were to take the time to properly explain your request you would have already had a solution by now. Based upon mine and the other responder's first posts you obviously did a poor job of it. I don't mean to berate you, just point out that it is beneficial to you (and considerate of those providing help) to take the time to effectively write a query.

 

Your last response is much different than your original question and contains a significant change - there are two variables in the strings. You also haven't stated where $keywords_id is coming from. Is it a static variable that will be the same for each $keywords value?

 

What you want to achieve can't be achieved through implode(), but based upon your last response and some of my assumptions for what you have NOT provided, you can try this

 

foreach(array_keys($keywords) as $keyword)
{
echo "<a href='{$keywords_id}'>{$keyword}</a>.";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.