Script Style

Started by beingchinmay, 08-24-2016, 07:07:44

Previous topic - Next topic

beingchinmayTopic starter

The final method of distinguishing PHP from HTML involves a tag invented to allow client-side scripting within HTML pages, the <script> tag. You might recognize it as the tag in which JavaScript is embedded. Since PHP is processed and removed from the file before it reaches the browser, you can use the <script> tag to surround PHP code. To use this method, simply specify "php" as the value of the language attribute of the tag:

Quote<script language="php">
echo "Hello, world";
</script>

This method is most useful with HTML editors that work only on strictly legal HTML files and don't yet support XML processing commands.