Ian Bicking: the old part of his blog

Re: The PHP Ghetto

Hmm, yes, there are stupid things in PHP. There are stupid things in Python. There are stupid things in Java. And so forth. PHP in itself is not evil. People tend to think that PHP is evil because it let you do evil things. Hogwash! Point me to any framework / language / OS that doesn't let you do evil things. Blame developers of said tool, not the tool itself. PHP done right can be truly beautiful.

I can understand the frustration that a popular module used for some time can turn out to be utter garbage, but hey, it is open-source, a world where good-enough can last you a long time until someone sits down and solve the problem once and for all some other better way. Feel free to jump in. It is all about ideas and developers, not tools.

Comment on The PHP Ghetto
by Alexander

Comments:

That's my point -- everything that was misused in PHP exists in Python. It's not PHP-the-language at fault, it's PHP-the-community or PHP-the-development-methodology.

In the case of libpng that people mentioned, that's actually a language flaw in C.

# Ian Bicking

I have major problems with PHP, I have a list somewhere of the things I hate the most about the language, which I really should dig up and blog about now that I don't work where I used to work anymore.

To give you an idea of the fundamental breakage that PHP gives us, let me show you why I hate the language.

To write an SQL query in PHP, there are two popular methods. One is an easy way, the other is the RIGHT way. Let me show you.

Easy Way:

mysql_query("UPDATE users SET age='$age' WHERE id = '$id'");

Right Way:

if (get_magic_quotes_gpc()) {
  $age = stripslashes($age);
}
mysql_query("UPDATE users SET age='".mysql_real_quote_string($age)."' WHERE id = '".mysql_real_quote_string($id)."'");

So PHP gives you a choice, use the easy to use "string $interpolation" syntax provided by the language, or write correct code. You can immediately see why there are so many security problems in PHP.

# Stephen Thorne

I hate to say this, but that's a pretty stupid argument. If your syntax for doing things the right way is long or complex, abstract it, wrap around it, fiddle with it, chuck it in a function or fold it to an object or obfuscate it in a Perl module or however else you'd like to make things simpler. This is what programming is all about, no? This is why annotations are popular. This is why Groovy is groovy. This is why Python is cool and Ruby shines. And it's why PHP isn't as bad as the PHP developer.

# Alexander