PHP, which is a recursive acronym for PHP: Hypertext Preprocessor, is a very popular, open source scripting language that is particularly suited for Web development and can be embedded into HTML.
What kind of introductory tutorial would this be without a good ol' "Hello World!" example?
Let's take a look at a very simple example of how php is used:
<html>
|
|
All of the color coded text above is PHP. Notice how it's embedded into the HTML? That's one of the great things about it. Unlike in other languages such as Perl or C where you write a program with commands to output HTML, PHP allows you to write HTML normally then just embed your PHP script directly into it.
PHP has opening and closing tags (the blue parts of the code in the example above) that enable you to jump back and forth between HTML and PHP. This is sort of like the <script> tag with JavaScript exept that the server handles the PHP code not the client's browser.
The better question would be “What can't PHP do?” PHP can do anything from collecting data from forms to creating dynamic page content to sending and receiving cookies and much more. For more information on what it can do, visit php.net
In order to use PHP, your webhost will need to give you access to PHP. If you aren't sure if your host allows PHP or not, try saving the code in the example above to a notepad as *.php, then upload it to your webhost and run the file. If you can still see the PHP code after the page has loaded, your host doesn't allow PHP.
An alternative would be to install PHP on your computer, this will allow you to test PHP scripts without having to keep uploading to your webhost over and over again. If you are really interested in learning PHP, I recommend you do this.
Installing PHP isn't a horribly difficult thing to do, You can look around php.net for documentation on how to install it, but I suggest this tutorial from aesthetic-theory:
Installing Apache, PHP4, MySQL4, PHPMyAdmin on a Windows System.
It's very easy to follow, it should get you up and running PHP in no time at all. 
Hopefully this tutorial gave you a better idea of what PHP is. For more information visit php.net's introduction
| Discuss Tutorial: Introduction to PHP | 28 Comments |






Hope you'll get some use out of these tutorials 
the following code would print out a quote: