Is using the HTML <pre></pre> tag a viable solution for displaying non-HTML content generated by PHP?

When generating non-HTML content using PHP, such as plain text or code snippets, it can be displayed in a structured format by using the HTML <pre></pre> tag. This tag preserves whitespace and line breaks, making the content easier to read and understand for users. By wrapping the PHP-generated content within <pre></pre> tags, it will be displayed as-is without any additional formatting applied.

&lt;?php
// PHP code to generate non-HTML content
$nonHtmlContent = &quot;This is some text generated by PHP.&quot;;

// Displaying the non-HTML content within &lt;pre&gt;&lt;/pre&gt; tags
echo &quot;&lt;pre&gt;$nonHtmlContent&lt;/pre&gt;&quot;;
?&gt;