why the "?>" tag won't close the php part? : <p>So I was writing some PHP scripts and also some HTML codes but this was what happened:</p>

<pre><code>&lt;?php
/*
some php scripts
*/
$q = "SELECT * FROM users WHERE id='1' AND username='test' AND pass='123'; /* the last line of php */
?&gt;
</code></pre>

<p>this was the last code that I used and after that I closed the php and started the html part:</p>

<pre><code>&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
</code></pre>

<p>so at this point when I check localhost and my database I get an error:</p>

<blockquote>
  <p>Parse error: syntax error, unexpected 'utf' (T_STRING) in F:\wamp64\www\Login2.php on line 47</p>
</blockquote>

<p>and it's because of the HTML code I used. although I closed the PHP with ?> it's still counting HTML codes as PHP!</p>
