Skip to content

High Quality PHP Code? Really?!

Many people seem to think that it is impossible to write high quality code using PHP. Too often, I see comments like the ones in RHO’s Cookie Monsters in the Closet:

Or maybe he (or He) was a PHP programmer?

[…]

This effectively shouts into your face “Hey, look what cool IF-statements a PHP programmer can write.”

[…]

Alright, you might object, this is a PHP programmer, so he does not know Perl too well.

Although there is a certain funny tone to it, and although I don’t take it personally enough to go on a rant about it, I want to point to this article: 10 PHP Myths Dispelled.

Simply because I hear this kind of joke way too often. And too often, people seem to think it’s a fact.

Low quality PHP code

I’m sure there are a lot of bad PHP scripts out there. Why? Because the threshold for writing PHP code and firing up a simple script is very low. And because it is so easy to throw together a script that uses a database for persistent storage, there are probably lots of scripts with tons of security issues out there. That, however, does not mean that PHP programming is for “script kiddies” alone.

Of course PHP has some weaknesses (I do for example hate the lack of namespaces, method overloading, inconsistent parameter order in builtin functions++), and of course you can write bad code using PHP — as can you in Perl or any other language.

However, by using OO, best practices, patterns, frameworks, etc. you can build good, scalable and robust PHP applications (that wont require hours or days of configuring to set up). And yes, that is possible.

What language is Facebook, Flickr, iStockPhoto, Feedburner, etc. written in, if not PHP?

Add Comment