This morning I read an article on ZDNet Australia titled “Andreessen: PHP succeeding where Java isn’t”, which is about a speech given by Internet browser pioneer, Marc Andreessen, wherein he predicts that PHP will inevitably become more popular than Java because of its simplicity. PHP might appear simple at first glance, but if you actually spend some time working with it, you begin to feel as though the language was built by a thousand monkeys at a thousand computers – the dumb kind employed by C. Montgomery Burns. The final result is such a dog’s breakfast (or should that be monkey’s breakfast?) that continued use only leads to the most unmanageable mess conceivable. Given the choice between a poke in the eye with a sharp stick, and using PHP, I’d take the poke in the eye.
As a case in point, consider the function naming convention, or total lack thereof, in PHP. The function to escape special characters in HTML (such as © to ©) is called htmlentities whereas the opposite is html_entity_decode. This is just the tip of the iceberg; PHP is riddled with these inconsistencies. Why anybody would willingly touch PHP is beyond me! Well, maybe it’s not totally beyond me, because I did try it once, but having bathed several hundred times since I last used it, I feel clean again.
Perhaps Mr. Andreessen will be proved correct, but just because PHP may become more popular than Java, or any other language, it doesn’t indicate quality. Just consider the so-called documentation for the above PHP functions and tell me that PHP is a quality product. The documentation alone probably makes up a good third of the reasons why PHP is a dog’s breakfast. Trying to make sense of disjointed ramblings is almost enough to make one pine for MSDN, even though I don’t much like the look of ASP.NET. Hec, I’d even consider using Ruby on Rails over PHP, even though it suffers from having a stupid name.
I’ll stick with Java, thanks, and if you want to make Java easier, there’s always Jython (even though I haven’t used it, I’ve heard very nice things about it).
P.S., I am aware of the irony that my web site is powered by a product designed using PHP. Wordpress is well written and since the poor developers at Wordpress have suffered the PHP pain on my behalf, I have no problem with using it :-)