Forum Moderators: coopster
I have an array of quotes from people who are saying things and I’d like to hyperlink keywords in their quotes. Ideally, this would mean several calls to the linkWriter() function. My initial attempts culminated with me finally throwing in the towel and I just hard-coded the HTML tags, although I was able to interject the global variables into the array variables so I didn’t have to hard-code the URLs.
WORKS:
exampleArray = array(“This is a <a href=\”“.$LINK1.”\”>perfectly cool</a> <a href=\”“.$LINK2.”\”>hyperlinked example</a>.”,”2”);
DOESN’T WORK:
exampleArray = array(“This is a “.linkWriter($LINK1).”perfectly cool</a> “.linkWriter($LINK2).”hyperlinked example</a>.”,”2”);
Any thoughts on why the first one works, but not the second?
I'm guessing you are not returning a value [php.net]:
function linkWriter($link) {
$link = '<a href="' . $link . '">';
return $link;
}