", "text": "<p>I was simply going through the tutorial of PHP there I found that we can write our PHP code using <code><script language="php"></script></code> tag also, and I was trying to figure out the difference between this and <code><?php ?></code> tag and advantages or disadvantages but didn't found anything, can anyone tell me the difference please.</p>\n\n<p>Thanks in advance.</p>", "answerCount": 2, "upvoteCount": 969, "dateCreated": "2012-04-02 06:10:03", "dateModified": "2022-10-20 01:05:27", "author": { "type": "Person", "name": "Dheeraj Agrawal" }, "acceptedAnswer": { "@type": "Answer", "text": "<p>I think, in terms of semantics there is no advantages or disadvantages. According to PHP manual:</p>\n\n<blockquote>\n <p>There are four different pairs of opening and closing tags which can\n be used in PHP. Two of those, <code><?php ?></code> and <code><script language="php"></script></code>, are <strong>always available</strong>.</p>\n</blockquote>\n\n<p><br>\nAlso, note that:</p>\n\n<blockquote>\n <p>If you are embedding PHP within XML or XHTML you will need to use the\n <code><?php ?></code> tags to remain compliant with standards.</p>\n</blockquote>\n\n<p>Anyway, the <code><?php ?></code> is the most commonly used and recommended to use it.</p>\n\n<p><strong>NOTE</strong>: Script tags <code><script language="php"></script></code> and ASP tags <code><% %></code> are removed from PHP 7. </p>", "upvoteCount": 122, "url": "https://exchangetuts.com/difference-between-php-and-script-languagephpscript-1640484904451094#answer-1652646724218660", "dateCreated": "2022-10-19 11:05:27", "dateModified": "2022-10-20 01:05:27", "author": { "type": "Person", "name": "Victor" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "<p>They both work <sub>(much to my surprise)</sub>.</p>\n\n<p>However, <code><?php ?></code> is by far the most common construction. You're much more likely to confuse fellow coders if you use the very rare deprecated <code><script></code> method.</p>\n\n<p>As a result, you should use <code><?php ?></code> merely to avoid confusion or potential compatibility problems across implementations. </p>", "upvoteCount": 20, "url": "https://exchangetuts.com/difference-between-php-and-script-languagephpscript-1640484904451094#answer-1652646724221923", "dateCreated": "2022-10-19 11:05:27", "dateModified": "2022-10-20 01:05:27", "author": { "type": "Person", "name": "Yahel" } } ] } }