php[architect] logo

Want to check out an issue? Sign up to receive a special offer.

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


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.
 

Responses and Pingbacks

Beautiful. End of discussion.

In the last few years the description that I’ve been using is that PHP is glue. I think this description fits, the web is mostly about gluing together various components to provide something useful. Though it isn’t always pretty, gluing things together is something that PHP does very well.

Fantastic post. Love it.

Here’s a interesting quote from a recent article here on phparch, Building the Backside β€” Part 1 :
“In case you did not know this, I love PHP.
It is the Swiss Army Knife of development languages”

“Why PHP wasis a GhettoScrewdriver”

http://codefury.net/2011/04/why-php-was-a-ghetto/

This is just a horrible post.

You are applying attributes of a non-object to a real object.

You also contradict yourself a lot, as mentioned above.

@ad2joe

πŸ™‚ caught me. Even I call it that from time to time.

@Chris
Sorry you didn’t like it but other than the fact that I called PHP a Swiss Army Knife in a previous post, I don’t see where I contradict myself “a lot”. And honestly, you are over-thinking the analogy. πŸ™‚

Thank you both for the comment!
=C=

Michael Taggart on
October 14th, 2011 at 8:26 pm

> you can drive screws with it, pry open pain cans,

I’m not sure if it’s a typo, but I love this line. The analogy of opening a can of pain many times describes how I feel when I throw the welding mask on and get under the hood of a complex application regardless of language.

Great post. I agree that PHP is what you make of it. We use it for everything mostly because it is so easy to get other developers up to speed with it. It doesn’t matter what their programming background is. Most of them can pick up PHP in less than a week.

@michael,

Yeah, I’m gonna blame that one on my Editor. πŸ™‚ I’ve corrected it to “paint” but you know, you are right, “pain” is fitting. πŸ™‚

Thanks for taking the time to comment.

=C=

Another typo? “A Swiss Army Knife is a bit bulky and kind of a paint to tote around…”

@mark

Thanks for pointing that out. Obviously I have a problem with the words paint and pain. πŸ™‚ They have been corrected and our editor has actually reviewed the article now and given it a thumbs up. (Something I probably should have had her do BEFORE I published it) πŸ™‚

Thanks for taking the time to leave a comment!
=C=

[…] in Sachen dynamisch typisierten Programmiersprachen voll auf PHP, aber wie der Titel schon sagt: Es ist kein Allheilmittel. Jede Sprache hat seinen Einsatzzweck und mit PHP kann man halt unheimlich viel machen, nur leider […]

wow nicely written praise to php, honestly when i was willing to start programming i found that php is my choice everything to need to program is found in there it depends on you the person behind the code how you build logic that matters it is the screw driver that got me by a lot in my professional life

Leave a comment

Use the form below to leave a comment: