PHP Errors inside of html blocks
<p>This has two questions wrapped into 1.</p>

<p>1) If my php script has an error inside of <code>&lt;div style="&lt;?php echo $1; ?&gt;"</code>, how can I make the php error handler to close this quote? I have already customized the error handler, but unfortunately, everything appears inside of the <code>&lt;div style="...</code></p>

<p>2) I have a php fatal error handler in the register shutdown function, is it possible to clear the rest of the buffer from the page (ie. display only the error message)?</p>

<p>Thanks,</p>

<p>Elijah</p>

<p>Update:</p>

<p>None of these answers are related at all to my question, so evidently I have been unclear.</p>

<p>Take, for example, the following code examples (one per line)</p>

<pre><code>&lt;div&gt;&lt;?php count('abc'); ?&gt;
&lt;div style="&lt;?php echo count('abc');
</code></pre>

<p>In the first case, the error message will print fine. In the second case, the error message will start to appear inside the div. If there is a " in the error message html (from a custom handler), then the tag will be closed somewhere like this (but it opens again at the closing of the new "):</p>

<pre><code>&lt;div style="&lt;div style="asasdf"&gt;errortext&lt;/div&gt;
</code></pre>

<p>Is there a way to force the browser to close these tags that will work in the normal case also? I do not think that there is, but sometimes something is possible somehow in cases like this.</p>
