PHP Sucks (originally by czth)
Note
This is a copy of a page that went offline from czth.net. I'll add links to it below.
PHP Sucks. "PHP is an abomination." - David Robins, December 17, 2002.
- PHP annoyances (broken link as of 2008-11-17)
- Some comments from use Perl;
- Experiences of Using PHP in Large Websites
- Nathan Torkington's list of PHP's shortcomings
- GNU-Friends article by lupo (broken link - parked domain)
- PHP in contrast to perl systematically points out PHP inconsistencies
- Joel on Software mentions PHP's willful ignorance of character encodings[1]
- The PHP::Strings perl module will provide much enlightenment
[1] character encodings are a pain in the neck, but they are necessary
Some points of my own:
Of course you can write complex scripts in PHP - it's Turing complete. It's just painful. (See Paul Graham's Succinctness is Power article.) You can write complex scripts in assembler; it's also painful. But assembler has a niche, a place where it shines: when you need to hand-optimize something or write low-level code (think kernels, trampolines, compiler magic). PHP doesn't. There's nothing for which it is the best choice.
A simple problem and a perl solution: remove all matches to id=some integer value (at the end of a string) from a list, also stripping off id=value from the other strings. (Admittedly this seems a little contrived but it was actually needed by somebody at some point.)
@array = grep { s/id=(\d+)$// ? $1 != $value : 1 } @array;
[2005-02-04] Finally there's a PHP equivalent from Jason Sweat, after almost 2 years:
$array = array_filter($array, create_function('$v','return !preg_match(\'/id=\d+$|id='.$value.'$/\',$v);'));
At least it's possible, but note the following two things: it has to parse code at runtime (think eval STRING), and that it makes use of perl regular expression matching (beats reinventing the wheel I guess). It just doesn't have the elegance of the perl (IMO).
More Links (by Shlomi Fish)
- "The Month of PHP Bugs"
- "PHP more maintainable than Perl, also Pepsi way better than Coke" - post to the Joel-on-Software board.
- Coding Horror: "PHP Sucks, But it Doesn't Matter"
- "What I don't like about PHP" -by Edwin Martin.
- Slashdot.org Review of the book "Securing PHP Web Applications"