Four Reasons to use PHP
From Wiki
- Is free. The Apache/PHP/MySQL combo runs great on cheap, low-end hardware that you couldn't even think about for IIS/ASP/SQL Server. One recommended distribution is [Installing_and_Configuring_a_Web_Server XAMPP]
- Open source software. The program as a whole is released under its own PHP license on the model of the BSD license (Zend as a standalone product is released under the Q Public License -this clause applies only if you un-bundle Zend from PHP and try to sell it). See www.php.net/license/ for more information.
- Ease of Use. PHP is easy to learn, compared to the other ways to achieve similar functionality. Unlike Java Server Pages or C-based CGI, PHP doesn't require you to gain a deep understanding of a major programming language before you can make a trivial database or remote-server call.
- (X)HTML-embeddedness. PHP is embedded within XHTML. In other words, PHP pages are ordinary (X)HTML pages that escape into PHP mode only when necessary. Below is an example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example.com greeting</title>
</head>
<body>
<p>Hello,
<?php
// We have now escaped into PHP mode.
// Instead of static variables, the next three lines
// could easily be database calls or even cookies;
// or they could have been passed from a form.
$firstname = 'Grace';
$lastname = 'Jackson';
$title = 'Ms.';
echo "$title $lastname";
// OK, we are going back to HTML now.
?>.
We know who you are! Your first name is <?php echo $firstname; ?>.
</p>
<p>You are visiting our site at
<?php echo date('Y-m-d H: -- i:s');?>
</p>
<p>Here is a link to your account management page:
<a href="http://www.example.com/accounts/<?php echo $lastname; ?>/">
<?php echo $firstname; ?>'s account management page</a>
</p>
</body>
</html>
When a client requests this page, the Web server preprocessed it. This means it goes through the page from top to bottom, looking for sections of PHP, which it will try to resolve. For one thing, the parser will suck up all assigned variables (marked by dollar signs) and try to plug them into later PHP commands (in this case, the echo function). If everything goes fine, the preprocessor will eventually return an usual HTML page to the client's browser.
PHP syntax is like the syntax of C programming language. If you already know C, this is very helpful; if you are uncertain about how a statement should be written, try it first the way you would do it in C, and if that doesn't work, look it up in our pages or in the manual.

