A few days back a colleague forwarded me a link to an article entitled Attacking PHP. It goes through a list of the problems associated with PHP. And based on my past experiences dealing with PHP in corporate environments, the analysis in that article is spot on.
In short, PHP is just not a suitable language for serious Web application development. I’ve seen it used for a wide variety of Web apps at numerous companies, but the results have always been negative.
As the article mentions, one of the main problems with PHP is that it’s sloppy. The standard library naming scheme is one particularly problematic area. This in turn promotes sloppinesss elsewhere, namely for those developers who use PHP to developer their own applications. Try as a developer might to keep his or her code clean, the use of standard PHP functions will begin to introduce inconsistencies.
The mixing of content and presentation is of course another very sore point when using PHP. Although it is possible to avoid this, we don’t always see this in reality. It becomes very convenient in the short term to mix those two distinct layers. But once an application starts to mature, nothing but problems arise. For instance, one team I worked with would continually break the logic of their PHP Web application when making cosmetic changes, since the business logic was so intertwined with the presentation code.
And when dealing with the Web, security is paramount. The Web is a very hostile place, and so we need to use programming languages that help enforce good software design. In this respect, PHP’s dynamic nature is unacceptable. While it allows programmers to rapidly create Web applications, these applications are often full of security glitches. Furthermore, type-related errors all too often cause problems when using a PHP application. Users are not impressed when an application crashes due to a failed type conversion because the PHP developer wrote sloppy code.
When you combine the factors above, you end up with a language that also promotes the development of near-unmaintainable code. Even if a PHP application is initially developed by somebody with patience and discipline, this level of care must be maintained throughout the entire lifetime of the PHP application. If the development standards drop for even the slightest of code, it is quite likely the PHP application will become a mess quite soon. Although languages like Java and C++ are not immune to such problems, they do tend to be far more resilient than PHP.
In short, PHP is just not a language that should be used for most large-scale applications. Although it may have its place for small Web sites, bringing it beyond that is just looking for trouble and heartache. Basically every time I have seen PHP used for real software development, the result has been spectacularly horrid.