Why Does PHP Suck?
whydoesitsuck.com
whydoesitsuck.com
It's not a terrific sign that the first set of complaints are about the syntax of PHP/FI, which was retired sixteen years ago. (Source: http://php.net/manual/en/history.php.php) If you're going to write an article about how PHP sucks, you should probably constrain yourself to how it sucks in this century.
The writer puts his comments in the appropriate context by stating,
"Obviously, PHP started as a procedural language…or did it? Actually, it started as some weird html-meta-language, called PHP/FI that looked something like this..."
> (define initial 'J)
> (define name (if (if (if (if (eq? initial 'M)
'Mike
(eq? initial 'J))
'John
(eq? initial 'C))
'Catherine
(eq? initial 'T))
'Thomas
'unknown))
> name
Thomas
Notice that the "then" clause and the "else" clause have two different types for all but the outermost if. The "then" clause is a symbol, while the "else" clause is a boolean. Furthermore, if the "then" clause is taken, the resulting symbol is considered truthy by the if operator. So, the innermost if expression evaluates to true, then, moving outward, we get 'John (which is truthy), then we get 'Catherine (which is also truthy), then finally we get 'Thomas, which is bound to name.PHP's truthiness rules are different from Scheme's (and are far more complicated), but for this particular expression, the net result is the same.
For comparison, every other language with a ?: operator behaves like this:
> (define nom (if (eq? initial 'M)
'Mike
(if (eq? initial 'J)
'John
(if (eq? initial 'C)
'Catherine
(if (eq? initial 'T)
'Thomas
'unknown)))))
> nom
John
Which is far more useful.> Believe it or not, I basically created this website just so that I could rant about PHP at an appropriate place.
> X-Powered-By:PHP/5.4.30
Generally someone who uses the language in question is best equipped to critique it.
Does a thing suck?
Should i use a thing?
The answer to both of them can be yes at the same time, while being entirely true. Yes, i know, grokking this requires a little mental nimbleness (seriously though, only a little), but is an unavoidable truth stemming from the inherent complexity of the universe and the interactions of everything in it. There is no black and white. There is only a vast morass of grey in a variety of dimensions whose numbers vastly outstrip what the human mind normally has to deal with.
And one of the points in that morass is where all programming languages sit: They suck, and given the right conditions they should be used.
And frankly, if you REALLY want to find out what sucks about a programming language, the best person to ask is someone who both has a deep love for the language which has given him the experience; and the integrity to be honest to himself, and the world, about what ailments that language really has.
We don't always have a choice in what language we use. Sometimes we do. In this case, he did. And he chose PHP. Not that it's here nor there, just seems ironic!
http://blog.hackensplat.com/2012/04/php-some-strings-are-mor...
whistles and walks away
As much as i dislike PHP, i can't take this rant seriously after reading a line like that.