Warum sollte HTML-Code nicht oberhalb von <?php stehen?

When HTML code is placed above the <?php tag, it can cause issues because PHP interprets everything as PHP code by default. This can lead to errors or unexpected behavior in the output. To solve this issue, make sure to start the PHP code before any HTML code.

&lt;?php
// Start PHP code here
?&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Example&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;?php
    // PHP code can be embedded within the HTML
    ?&gt;
&lt;/body&gt;
&lt;/html&gt;