PHP is a pain. I could not stress how severely its role in dmtdev shames me. A novice programmer can pour out functionality in little time with PHP—that is, until they actually need to use it. Here are few of many annoyances:
- Inconsistency in the API. PHP’s naming conventions include camelCase, strungtogether, and with_underscores.
When something fails, a function will throw an exception, return null, return false, or pretend everything worked.
If something miraculously works, a function will return an array, some obscure object, some deformed string representation, or some grotesque “mixed” value. - An adhesion of concerns pattern?
Employing the MVC paradigm seems discouraged. - No Unicode⁈
WFFSMNADHAED is with that? There are some work‐arounds that only partially solve the issue and are painful. - Slow.
Parsing a PHP page must feel like running software written in COBOL: it takes longer than it should. - No namespaces.
Excepting those in some extensions, functions are defined for the global namespace. - Thread safety ≈ 0.
Hence the Apache2–PHP crisis. - Weak typing is good for headaches—nothing more.
Types are not declared and implicit casts are rampant. Dynamic typing is expected for a fully interpreted language, but weak typing boosts error‐prone code. Undefined variables should not equal zero. - PHP versions are often backwards‐incompatible.
The 4.3 to 4.4 change to reference handling and the 4.x to 5.x changes both removed backwards‐compatibility. - Broken features lead the PHP developers to add more features.
Hence that many keywords, functions, and superglobals. - Platform dependency
Certain functions are only available under certain platforms (for instance, money_format()). Many of these functions are defined in the standard PHP libraries. - Poor security
For a language that requires security, it is insecure. Magic quotes? Broken hash functions? Random loss of entropy (pardon the pun)?
Each of those issues is serious. The lack of namespaces alone might be sufficient motivation to switch. My experience using lightweight languages for web‐centric development—and, in fact, any development—is generally poor (including with PHP, Ruby, Python, ASP *shudder*, and Perl), but I plan to rewrite dmtdev sometime in any language that does not cause me to cringe on thought. I have been trying server‐side Java with Servlets and Tomcat and thus far approve of it. I am not fond of JSP but like Apache Velocity. I will see and write about it.
Agree? Disagree? Comment!