PHP: Basics
PHP, known formally as PHP: HyperText Preprocessor, is a popular, powerful and free open-source language. It can be used for a number of different reasons, some including management of large databases, reading and writing files, creating images and communicating with remote servers. It can be used with HTML, however, your server must have PHP Support in order to run the PHP commands. Also, when using PHP codes with HTML, you must use the appropriate file format extension. For example, mypage.html will not run your PHP codes, but mypage.php will since it has the appropriate extension (.php). There are many ways you can use PHP. I use it to run my databases for all my websites and, of course, use php includes to make updating my site layout much easier. For the complete PHP Guide, visit the official website.
How to write PHP
You can write php in one of three ways with the first and second way I list being the most common. When using PHP, you have to save with the file extension .php and make sure that your host/server supports PHP.
First Format
<?php
php code goes here;
?>
Second Format
<?
php code goes here;
?>
Third Format
<script language="php">
php code goes here
</script>
Pay attention to the first two formats. You need to use the semi-colon character (;) to end each code or else the script will return an error. In the last format, you don't have to use the semi-colon. Use whichever format is suitable for your coding or whichever one you feel comfortable with.