KillerPHP Blog

Why build all your web pages in PHP?

May 15, 2008

I recently had this question put to me by a web designer who was considering the idea of using PHP pages in her websites:

“Why build all your pages in PHP … Why not use standard .html pages?”

She then expanded the question to:

“What I mean is…… what’s the benefit to building ALL sites in PHP?”

Note to uber-nerds: remember that this question is being put to me by a web designer who has never written software. As such the answer is tailored those who are new to programming.

I might tackle this question from another perspective if the question was put to me by an experienced developer.

PS: If you find my answer offensive to your nerd-sensibilities, you might want to read this.

The Answer:

By making all your web pages PHP pages from the start, you are basically leaving open the possibility of using PHP in your web pages at any time.

… You don’t want to (at some later date) have to go back and change your .html pages to .php. For example:

... becomes:

Beginners should note, that you need to have .php extension on any web pages where you want to use PHP. Check out my basic PHP videos for details.

PHP can do a lot more than just talk to MySQL. One very common use of PHP is to create ‘includes’ … this will allow you to insert snippets of code in your pages from separate files. This is kinda like using external CSS files. So you can use PHP includes to say create your page footers.

You can learn more about PHP includes in my free videos.

In the end, by making all your pages php pages from the start, you will just have a more flexible website to work with since you will be able to access PHP’s power.

Stefan Mischook