PHP and why you should use it

PHP is a programming language that is arguably one of the easiest to learn, cost efficient and common languages out there. It is used primarily to create dynamic website content. By dynamic I mean that it flows and it can change in a way that static website content can not.

With so much time invested by individuals and businesses in establishing themselves with a programming language, bias is inevitable, and you don’t have to dig deep to find someone criticising PHP. But then, the same goes for any language. Each has their own advantages and disadvantages.

What remains a fact is that PHP has been popular in the past, is popular now, and will continue to be popular well into the future.

Some of PHP’s advantages include:

  • Considered easy to learn as far as programming languages go, meaning it is very well known in the web development community
  • Hosting is more common and cheaper than for any other language
  • Large range of turnkey php applications available, some free, some not. Examples include WordPress, (the software this forum is running on), phpBB and wikipedia.
  • Abundance of free online resources

Here is a classic usage for PHP;
Situation – A shop owner wishes to supplement their traditional shop with an online shop, in the form of a 500 product website.
Solution A: Build a static website, and make 500 separate pages to accommodate each and every product.
Solution B: Build a dynamic website, create 1 product page and create 500 database entries

So what is the difference? In any case, the shop owner / web developer is going to have to process 500 products. Sure this sucks, at least initially.

PHP starts flexing its muscle when we get to the ongoing management side of things. The shopowner has decided that the product pages would convert better if the pictures were at the top of the page, instead of at the bottom;

Static Site: guess what – 500 product pages = 500 pages to download, change and upload – say goodbye to your trip to the beach this weekend!
Dynamic Site: 1 product template = 1 file to change, 500 ‘pages‘ updated in one foul swoop.

The reason for this miracle of time saving is because PHP, in combination with a database language such as MySQL can join forces to create what you seen in your web browser on the fly. As a page is loaded, PHP instructs the database to return the relevant information for the product in question.

This is but one hypothetical situation – but instantly you can see the scalability of PHP. This is really only the tip of the iceberg.

One of the cool things about PHP as one delves into the “web development” field, is that as you look for more and more advanced concepts every day, the inbuilt functionality is sure not to disappoint. I’m yet to hit a point where I think, “damn I wish I could do that in PHP!”.

Perhaps years down the road one might hit this roadblock, but as long as the team behind PHP keep there eyes on the ball, and the community remains strong and innovative, that day will*never* come. The point here is that who knows where the internet will be in 10, 20 or 50 years time.

Further Reading:
Comparison of Programming Languages
PHP Usage Graph
Programming Movers and shakers

PHP Server Side Includes

One of php‘s most practical solutions is a server side include.

Consider the navigation at the top of every page on this website. At time of writing there is 7 unique pages on, excluding this blog. If I were to add a new page to my site, would I not have to update each and every page to show the new link?

What a horrible sounding job — what if I had to make 2 or 3 changes to each and every one of those pages? In the context of 7 pages this might take say 10-15 minutes to open, change, save and upload 7 files. But what about if I have 20, 50, or 1000 different pages? This could take a day, if not a week!

What a horrible way to spend a week… and yet i’m sure someone, somewhere, in a deep, dark dungeon has slaved away at this menial task for hours on end.

All bow to King server side include!

A Server Side Include is a fairly ordinary file that is created for a website. It can contain any kind of web friendly content, but the most common usage is to display the same things over and over on different pages. So utilising this fantastic technology I have 1 file that contains my main navigation. If I want to rename, add, delete… or make any change under the sun, a server side include is my friend. I change the file once, and like magic every instance of the file is now reflecting the changes. Cool huh?

For any web people who have just read this post, don’t worry, I won’t leave you in the dark about how to do it – my favourite method is php.


For Dreamweaver users, use brackets – the above will leave a lovely/nasty little php symbol instead of the visual contents of the file. Try this to have the file contents display perfectly in your design view:


Remember that the path can be relative or absolute. If you work with folders for example, you may need something like this if the current file is located in its own folder.


You can also use the absolute path, which is commonly required in configuration files of popular applications. You will need to know your absolute server path, which frequently looks something like this:

 include ('home/username/public_html/includes/navigation.php'); 

Need help setting up server side includes or developing your site in some way? Read about Thomas Multimedia’s web design services¬†