I Will Never Understand the Appeal Of PHPDecember 09, 2006
In PHP there is no alternative to embedding everything together; although you can certainly include other files, there are no real namespaces, so you can't really separate concerns without artificial complexity. Everything is interpreted (which I think is its main appeal) so changes appear directly without any need to compile or redeploy (anyone using traditional J2EE application servers like Weblogic will groan at that word, for me with Jetty it's about 2 seconds). It is appealing - for a while. Everyone I know who works with PHP admits that their application code gets uglier and less appealing over time even if they work hard at trying to keep order. Bugs and flakiness occur with greater frequency as portions of the code get less and less readable, especially as programmers turn over and are less familiar with the nest of language elements in each file. This can happen in any language but the rate of deterioration in PHP is way faster than the expected lifespan of the application.
In my last job the main storefront was written in PHP two years earlier, and listening to the programmer stuck maintaining the beast (not the original coder), the constant problems the storefront had, and the shear inability to make serious feature changes left no doubt it needed to be thrown out.
If there is anything that I have learned over the years is that you can make something run out of almost any technology. However I have also learned that just because something is easy and quick, it doesn't mean its going to stay that way. Very often an application spends far more time in maintenance than in initial development, so being able to jump in and understand some code you didn't write is really important and far more common than starting from scratch. With PHP (and ordinary JSP and ASP as well) I rarely see code that can be jumped into; most of the time you just want to throw it away and start over. With a proper separation of the application's layers/parts/components you can more easily understand the code and make changes without creating more bugs. Unfortunately with PHP (among others) it's usually beyond the developers to write easily maintainable applications as the language simply doesn't allow it.
Of course code in any language can be poorly written; I've seen my share of abysmal java code, objective-C, C++, C and even assembler. It seems to me that using a language well and avoiding its stupidities isn't always that easy (and many programmers have little discipline to learn how) but with PHP it seems the programmer benefits are far outweighed by its drawbacks. I bet the ultimate PHP coder can do a careful job of creating good code, but the problem is that the average coder is highly unlikely to due to the language itself.