<tr>和<td>标签覆盖<pre>

Is there a reason why <tr> and <td> tags would work whilst inside a <pre> tag?

I am using a <pre> tag to show some PHP code on a website and within the code are various instances of the html tags <tr> and <td>, these are jumping out of the <pre> tags and executing at the bottom. Why would they do this??

They are included after echo and inside "" and '' and both are executing the same. I have no pre in my CSS and can't find any similar problems on the net.

Example:

echo '<table border="1">';
echo "<tr><td>A</td><td>B</td><td>C</td><td>D</td><td>E</td></tr>";
while($info = mysql_fetch_array($data)){
echo "<tr>";
echo "<td>" . $info['a'] . "</td>";
echo "<td>" . $info['b'] . "</td>"; 
echo "<td>" . $info['c'] . "</td>";
echo "<td>" . $info['d'] . "</td>";
echo "<td>" . $info['e'] . "</td>";
echo "</tr>";
};
echo "</table>";

I have tried using print, no change

You have to encode the < and > as HTML entities.

http://htmlentities.net/

so < would be &lt; and > would be &gt;

I think the specific use of <pre> tag is to display the element as what is it, even non-&nbsp; multiple spaces will be display, nor a breakline by a keyboard (non-<br /> tag), and not to fail a HTML tag. You can use this format &lt;tag> to fail a tag. But I didn't know if <pre> can fails a PHP code.