Why PHP Sucks

From Jonathan Gardner's Tech Wiki
Jump to: navigation, search

Bugs, bugs, bugs, bugs

PHP is full of bugs and inconsistencies. You have to refer back to every function until you know their true behavior by heart.

elanthis on LWN.net sums it up best:

The entire PHP codebase and language is a bug, and this is from someone who

worked with it professionally since 2001. I cannot put into words the number of absolutely stupid behaviors and design decisions that have gone into PHP and _still_ go into PHP (there was a new batch of them in 5.3 and there's another new batch of them in 6.0 I've already identified). The PHP developers are, for the most part, incompetent and clueless. The same is true for the vast majority of downstream developers that use PHP to write their applications. I cannot recall seeing a clean, well-written PHP codebase in the Open Source world, ever. The poster-projects of PHP are amongst the worst, in fact, including WordPress, Smarty, and osCommerce (before it died off).

If you're a PHP programmer, you just need to learn to roll with the crap.

endosquid's environment sounds like a problem; that kind of setup might work for stand-alone C++/Java apps that are fairly self-contained, but in a setup where your code depends on the behavior of a ton of underlying crazy runtimes and libraries, you just need to be ready to deal with the inevitable breakages that occur when the runtime simultaneously fixes old broken design screw-ups that you may have depended on, especially since you're going to end up depending on new design screw-ups that they're constantly introducing to work around the ones they're removing.

Variable Instantiation with Assignment

One of the worst bugs in C and other languages is that you can create variables that don't have a value assigned to them.

In C, this leads to spectacular failures. In PHP, this leads to surprising behavior.

Python does it right: The first assign is how you instantiate. There is no other way.