How to preserve &amp; in <pre><code>

Posted by Marcy Sutton on Stack Overflow See other posts from Stack Overflow or by Marcy Sutton
Published on 2010-04-30T03:35:26Z Indexed on 2010/04/30 3:47 UTC
Read the original article Hit count: 349

I am having trouble preserving an ampersand in a code example on my blog, because all HTML entities start with &.

Any tips?

For example:

<pre>
<code>
$pageTitle = str_replace('&', ' &amp;', $page->attributes()->title);
</code>
</pre>

Renders as:

$pageTitle = str_replace('&', '&', $page->attributes()->title);

© Stack Overflow or respective owner

Related posts about html

Related posts about escape-sequence