I've programmed all sorts of web stuff for about 10 years now but during the last three month I've come to
like PHP because of one special reason: thanks to it's language/framework hybrid nature and tremendous
build in functionality very much work can be kept extremely simple.
It's dynamic typing keeps you productive and keeps well written code more robust (don't hang me on that, I
know that many people think different about this, but static typing isn't always your best friend). You don't
need a template system because PHP in it's nature is already one and supports that with details like an
alternative syntax for control structures. Often a bunch of functions is all you need and for small
problems this fits perfectly with a procedural programming style. Want to get a file from another web- or
FTP-server? file_get_contents can handle it and if you need some special stuff just set some stream
context options and you're done. This makes things like interaction with REST interfaces a breeze and keeps
administration overhead of the resulting software low or almost zero (no dependencies…).
You can get a lot of stuff done without having to resort to object orientation. While providing encapsulation
(when done right…) object orientation tends to complicate the over all problem. However some magic
functions provide the means to build very crisp and usable interfaces. That is if one can leave
the dogma of "pure object orientation" behind (Java isn't by far the best OO citizen) and can start to think
in creative ways (e.g. like the jQuery folks did).
One can argue that PHP, when compared to general purpose languages like Ruby or D, has some awkward
corners. When seen with its purpose as a language/framework hybrid for web development, PHP however is
a very well done and equally well maintained piece of software. I have to admit the only other hybrid I know
and have experience with is ColdFusion… and it's just no match. And don't get me started on languages like
Java, they have enough awkward corners even without trying to excel in a special application like web
If some of the PHP guys ever reads this: Keep up the good work and preserve the unique nature of PHP if
you can. I know the business always likes complexity but keeping stuff simple ensures that a language stays
alive an fun to use.
ps.: I want to clarify that I don't hate object orientation. I just think it's not the right tool for everything in
every situation. In the right spots or when really done right it can do miracles (see Ruby and Ruby on Rails)
but that's not easy and by far not every one gets it right.