not show a parse error?", "text": "<p>I was running the following PHP code:</p> <pre class="prettyprint"><code><?php </script> ?> </code></pre> <p>There were no parse errors and the <strong>output was</strong> "<code>?></code>" (example).</p> <p>In similar cases I do get a parse error:</p> <pre class="prettyprint"><code><?php </div> ?> </code></pre> <blockquote> <p>Parse error: syntax error, unexpected '<' in ...</p> </blockquote> <p>Why doesn't <code><?php </script> ?></code> give the same error?</p>", "answerCount": 1, "upvoteCount": 972, "dateCreated": "2012-11-05 08:20:50", "dateModified": "2022-09-18 05:01:31", "author": { "type": "Person", "name": "Irfan" }, "acceptedAnswer": { "@type": "Answer", "text": "<p>This must be because there are various ways of starting a block of PHP code:</p> <ul> <li><p><code><? ... ?></code> (known as <code>short_open_tag</code>)</p></li> <li><p><code><?php ... ?></code> (the standard really)</p></li> <li><p><code><script language="php"> ... </script></code> (not recommended)</p></li> <li><p><code><% ... %></code> (deprecated and removed ASP-style tag after 5.3.0)</p></li> </ul> <p>Apparently, you can open a PHP block one way, and close it the other. Didn't know that.</p> <p>So in your code, you opened the block using <code><?</code> but PHP recognizes <code></script></code> as the closer. What happened was:</p> <pre class="prettyprint"><code><?php <----- START PHP </script> <----- END PHP ?> <----- JUST GARBAGE IN THE HTML </code></pre>", "upvoteCount": 115, "url": "https://exchangetuts.com/in-php-why-does-script-not-show-a-parse-error-1639480263811997#answer-1646667291596488", "dateCreated": "2022-09-17 05:01:31", "dateModified": "2022-09-18 05:01:31", "author": { "type": "Person", "name": "Pekka" } } } }