<p>In a PHP application I am writing, I would like to have users enter in text a mix of HTML and text with pointed-brackets, but when I display this text, I want to let the HTML tags be rendered by the non-HTML tags be shown literary, e.g. a user should be able to enter:</p>

<pre><code>&lt;b&gt; 5 &gt; 3 = true&lt;/b&gt;
</code></pre>

<p>when displayed, the user should see:</p>

<p><strong>5 > 3 = true</strong></p>

<p>What is the best way to parse this, i.e. find all the non-HTML brackets, convert them to &amp;gt; and &amp;lt;?</p>

I'd recommend having the users enter BBcode style markup which you then replace with the html tags:
```
```
[b]This is bold[/b]
[i]this is italic with a > 'greater than' sign there[/i]
```
```
This gives you more control over how you parse user's input into html, though I admit it looks like an unnecessary burden.