PHP Scripting Tags

PHP Scripting Tags

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. In PHP programming you will have .php web documents when you need for PHP to process in them. 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, most website servers process PHP by default. Below we demonstrate 3 ways to apply PHP code to your documents: (1) Normal PHP opening/closing tags (recommended common way) (2) The HTML script element (3) PHP short tags (avoid this way) (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.

0 Response to "PHP Scripting Tags"

Post a Comment