PHP Escaping Characters
<p>I've <em>have</em> done some searching and browsed similar threads but I can't figure out how to escape the characters in the following PHP string:</p>

<pre><code>$var =  '&lt;a href="'.$confUrl.'/index.php?a=profile&amp;u='.$TMPL['username'].'&amp;r=2"&gt;&lt;/a&gt;';
</code></pre>

<p>For some reason the <code>href</code> isn't working with my code, but somehow <code>window.location.assign(x)</code> seems to work. I can't figure out how to escape character this string without somehow making the string invalid. I'm aiming to turn the above <em>invalid</em> code to the following:</p>

<pre><code>$var =  '&lt;a onclick="window.location.assign('.$confUrl.'/index.php?a=profile&amp;u='.$TMPL['username'].'&amp;r=2')"&gt;&lt;/a&gt;';
</code></pre>
