The mini PHP crash course

July 5, 2006

When PHP was first invented, it was short for:

‘Personal Home Page’

Then later (to make it seem fancier,) the nerds in charge of PHP, changed their minds and said the ‘PHP’ was a recursive acronym for “PHP: Hypertext Preprocessor”. Whatever PHP stands for, it is the most popular web scripting language today.

PHP allows you to create dynamic web pages easily and quickly. It is easy to learn and once you get the basics down, you will progress quickly and start creating some useful PHP scripts.

In non-geek terms: PHP is a programming language that runs in conjunction with a web server (ex: APACHE) that allows you to create web pages that change automatically. Examples of such include guest books, discussion boards, shopping carts … and so on.

I’m not going to try and teach you PHP here, but I thought it might be fun for you to see what it looks like.

PHP is very simple to use; the first thing to note is that PHP is embedded into HTML. That is to say, that PHP code is intermingled with your HTML code:



echo “Hi, I’m a PHP script!”;



The PHP code is enclosed in special start and end tags that allow you to jump into and out of “PHP mode”.

The special start tag is:


And the special end tag is:


Anything in-between these special tags is processed by the PHP engine.


In a nutshell: The PHP engine is just a program that knows how to read and process PHP code. In the above example we are telling the PHP engine to do something very simple: print “Hi, I’m a PHP script!”.

In PHP (like in all programming languages,) there are special keywords that tell the PHP engine to do something.

In the above example we use ‘echo’, a special keyword/command that tells the PHP engine to print something to the HTML page.

So now you know PHP pages are just like HTML pages, except that they have special PHP code in places surrounded by the special PHP start and end tags. Oh yeah, PHP pages have the extension (that is to say: end with the letters) ‘.php’ rather than ‘.html’.

So if you have an HTML page called: ‘books.html’ and you wanted to add some PHP code into the page to for example, grab a list of books from a database, you would first have to change the page name to: ‘books.php’ and then insert the PHP code into your page.

You need to rename any html pages that have PHP code in them to ‘.php’, so that the PHP engine knows that there is PHP code in there.

Finally, you cannot run PHP pages unless your server has PHP installed. This is very likely since PHP is free for everyone, and runs on both Windows and non-Windows servers like Linux.


This was just an ultra-quick introduction to PHP where for many of you, some things will probably be hazy. Don’t worry, there are many more articles and videos here that will clear things up.



Comments are closed.

To Top