I have the following variable being dynamically set by user generated content:
$variable = '<a href="http://www.mysite.com/article">This Article</a>';
When this variable is set, I then echo it as such
echo $variable;
I know that as is, this wouldn’t be valid because I would need to escape the double quotes etc.
Is there a way to automate the process to make the variable printable as a clickable link, thus escaping the quotes in my variable automatically?
Edit:
Turns out this is indeed perfectly valid, but this being used on a joomla site, html tags are being stripped out, and I have to use [[a href]] instead of the regular <>.
Thanks everyone for your help!
I tried to use your exact code in a php page I have and it acts as you need it to. Seems to be working just fine for me.