Script Tags

Published :
Author :
Adam Khoury
In order to create a PHP document name your file "example.php" instead of "example.html". You can still place HTML code like you normally would into the document, but now you have the ability to work with PHP code inside of the document also. Some PHP documents that you create will not have any HTML code in them, some are all PHP script. Note: In order for your PHP tests to work on your local computer, PHP and Apache must be installed and running stably on your computer. Otherwise you will have to test online in your website server, where PHP processes by default. There are 3 ways to apply PHP code to your documents. (1) Normal PHP tags (recommended common way) <?php echo "Hello World"; ?> (2) The HTML script element <script language="php"> echo "Hello World";</script> (3) PHP short tags (avoid this way) <? echo "Hello World"; ?> Note: PHP short tags can only be used when short_open_tag is enabled in your php.ini configuration file, or if PHP was configured with the --enable-short-tags option. Many developers do not use this approach because of software migration issues that it causes from one server to the next.