What is PHP?
PHP is a computer programming language which is very useful for web site design, which is what you are probably interested in! PHP is also very useful as a general purpose scripting language, see other articles here.
According to the manual, PHP is also a recursive acronym for “PHP: Hypertext Preprocessor”, but non-geeks might be better off not trying to figure out what that means!
Reasons to use PHP
There are many good reasons to use PHP, here are a few…
- PHP is available on virtually all good web hosting services, and it is FREE!
- PHP is easy to learn and use, even for many non-programmers!
- PHP code can be written directly into a web page (ie, embedded in HTML).
- PHP provides full featured, built-in database access functions.
- PHP code is similar to C/C++, Java and other languages, familiar and portable.
Where PHP fits into your web site
So how is PHP used in a web page? Here is a simplified example…

Figure 1
Most web sites will use a database to store content such as product data or user information. But how do we pass that information into the database, or pull it from the database into a web page. The answer is a block of PHP code!
In a sense, you may think of PHP as the glue that bonds the different parts of your web site together.
The object of it all: PHP with class!
For a slightly expanded example, look at Figure 2 below. It introduces a new concept: PHP classes. You may have heard the term Object Oriented Programming, or OOP before. Well, that is what classes are all about!
Think of a class as a type, or blueprint for some object with specific properties or methods of doing things, such as inserting a rotating ad into your web page. Then, to put those ads into any page all you need do is add an object of that type to the page – they are reusable!

Figure 2
Here we show a web page that relies on several PHP classes to generate content, draw information from multiple resources (such as files), verify submitted data and handle cookies for a better user experience!
The ideas of Object Oriented Programming were developed specifically to make large programming projects manageable. The main benefits are…
- Reusable code
- Maintainable code
PHP with classes benefits from all those ideas to make your web site manageable too!
As you can see, PHP is literally at the very center of your web site design! 
|