PHP is not a Swiss Army Knife, quit calling it that.

Posted by on October 11, 2011
 

I’ve heard a lot of people compare PHP to a Swiss Army Knife. You know the ones, 5 blades, a corkscrew, a saw…and the obligatory toothpick that you will lose so you might as well take it out now and just throw it away. Why anyone would consider PHP to be like this is beyond me.

A Swiss Army Knife undergoes a lot of design work before it is released. It is well designed, it is engineered, it is purposeful.

A Swiss Army Knife is polished and refined. You never see a brand new Swiss Army Knife with metal burrs on the blade, or scratches on the casing. It’s beautifully chromed and polished.

A Swiss Army Knife is a bit bulky and kind of a pain to tote around just in case you need to saw something less than 2 inches thick. The larger ones are pointless. Who is going to carry that and even if you do, you can’t hold it comfortably to use it.

No, PHP is none of those things, it is not purposefully designed, it is not polished, and it is not bulky.

PHP is a screwdriver. Not a Wal-Mart $2 screwdriver, PHP is the Craftsman screwdriver your grandfather has had in his toolbox for 10 years and will one day be yours.

PHP is ugly. Yes, I said it, and I don’t care. Sometimes PHP’s syntax can be an ugly beast. You don’t like that, go work with a language that is designed for beauty.

PHP is lean…or at least as lean as you want it to be. Have you ever compiled PHP from scratch? If not, I urge you to try at least once. The options you can turn on and off are amazing. You can tailor PHP to your exact needs and leave out everything else.

PHP is useful. Like that old screwdriver, you can drive screws with it, pry open paint cans, clean out gunk from under your fingernails, or flip it around and beat down a stray nail with the handle. When you are done, you just toss it back in the toolbox until the next time you need to get something done. PHP gets out of your way and lets you get stuff done.

Yes, you can do stupid things with PHP, you can with any language. Like pointing a screwdriver at your eye, it’s easy to do serious damage. That’s not PHP’s fault though, that’s your fault, quit blaming the language.

PHP is a more widely used language on the web for one very good reason, when you need to get something done, it’s always there in your toolbox, ready for you to take out, abuse in new ways and then put away. You can carry around a Swiss Army Knife if you want and hope the situation you are in can be solved by one of the 5 blades…or the corkscrew, or you can just pick up a screwdriver and get the job done.

Photo Credit: tnz
Released under CC BY-ND-2.0


About the author—Cal Evans is a veteran of the browser wars. (BW-I, the big one) He has been programming for more years than he likes to remember but for the past [redacted] years he's been working strictly with PHP, MySQL and their friends. Cal regularly speaks at PHP users groups and conferences, writes articles and wanders the net looking for trouble to cause. He blogs on an "as he feels like it" basis at Postcards from my life.