What are best practices for ensuring PHP output is not wrapped in HTML tags on different server configurations?

When outputting PHP content, it's important to ensure that it is not wrapped in HTML tags to prevent unexpected formatting issues on different server configurations. One way to achieve this is by setting the content type header to text/plain before any output is sent. This tells the browser to treat the content as plain text, preventing it from being wrapped in HTML tags.

<?php
header('Content-Type: text/plain');
echo "This is plain text content";