PHP is a /great/ first language...for a hacker
nerdlife.net
nerdlife.net
But, that said, I agree with the point of your essay. It really doesn't matter that a hacker's first language is lingustically impoverished. The entire point of being a hacker is that you go on to learn several more languages. And I don't buy the argument that your first language indelibly warps your mind -- that's an argument from the era of old-school microcomputer BASIC, the kind with line numbers, no function calls, and only global scope. That was a terrible language, far more impoverished than PHP ever was, yet I and everyone I know started with it, and we all grew out of it just fine.
The other point I'd make is that far too much attention is paid to the reasons why PHP sucks, when we should instead be trying to figure out why PHP even exists. Specifically, we should be trying to figure out why all the PHP programmers didn't learn Perl instead, and (more importantly) why Java didn't displace PHP despite its massive marketing advantages and its (supposedly) better design.
Because you can go to GoDaddy today and pay $3.99 for a hosting account and start writing PHP code right next to the HTML in your site. It's simple. If all you know about web programming is HTML, then PHP is an easy next step.
Also, it's widely used.
Does Perl do that? I don't know. I don't think Ruby or Python come close to the simplicity. It took me way longer to set up my first Rails server than it did to write my first PHP function.
And I don't know of any technical reason why Perl couldn't come installed on a $3.99 web hosting account. (Perhaps it did, back in the day. I no longer remember. I did web programming in Tcl back then.) I've also heard that Python is fairly easy to host, and even Ruby is getting there -- Heroku gives you Rails, for perhaps even less effort than it takes to use your cheap webhost's PHP. You don't even have to figure out ssh or FTP to use Heroku.
But, alas, the problem is bigger than that. It's not just the first five minutes of Perl that are tough. It's the twenty hours after that. And something like Rails, which requires you to be familiar with databases and OOP, is on yet a higher plane of difficulty.
"Fatal error: Out of memory (allocated 6553600) (tried to allocate 77824 bytes) in /home/nerdlife/public_html/wp-includes/pluggable.php on line 981"
I'm not sure if this supports or refutes whatever point the author was intending to make.
I personally see nothing at all wrong with PHP. I'll go read some of the other posts, but I wonder what's so bad about it. (OK, except that built in function names have no pattern to the naming.)
I think people hate it precisely because it's so easy to get started with. Have you ever met people who, the more obscure something is, the more they like it?
Linux is now too mainstream for them, so they use hurd. You see it with health food too - regular health food is too mainstream, so now you must eat local. Soy used to be eaten only by health nuts, now that it's mainstream, they say not to eat it.
These are people who hate all the regular languages and love the obscure ones (I won't name them for fear of flame wars). You can like an obscure language, but if you also hate the regular ones, you just want to be different and that's all.
Or have you every seen a serious project done in Whitespace, Brainfuck, etc?
Another reason to dislike it is that it occupies a somewhat awkward niche in the language spectrum. It's not as strict as something like Java, which can make it more difficult to use for large projects. It's not as powerful or expressive as something like JavaScript or Ruby/Python, which makes it a lot less fun to use.
The only thing PHP really has going for it is that it's the closest you can get to a language that allows you to just write code that works "on the web", without having to fiddle with any server configuration or install anything (and it has a good set of libraries well-suited to this purpose).
Yes, this is all true. Being different is fun!
But some people use real programming languages because they understand programming, not because being intelligent is "obscure". It is possible to get started with PHP quickly, but I can hack applications together very quickly in Perl and Lisp too. The difference is that these quick hacks turn out to be maintainable and extensible. Hacking around PHP's brokenness gets very tiring very quickly. (PHP is like writing C that executes 1000x slower and requires more use of the shift key.)
Just because PHP is easy doesn't mean that it's the only language that's easy -- pretty much everything but Java and C are just as easy. (And with the right tools, these are pretty easy too.)
But Python and Ruby, among other languages, are also available for Web programming, and you can get things done quickly in them as well. Plus, you can do some things in them much more easily than in PHP.
I think the most important thing in the development of any hacker is to constantly scratch the creative itch. A close second to that would be to constantly explore.
While PHP scores better on those measures than some other languages, I think developers that use it day-in and day-out eventually find it painful to use. At that point, the language becomes a burden, because it discourages you from creating and exploring.
I think it boils down to where you are on the learning curve and how much heavy lifting you need/want to do on a regular basis.
I hold out great hope for these languages, but they are still very new. (Technically, the languages themselves are as old as PHP or older, but their popularity in the web problem space is new.)
Some of the advantages of being old are easy to appreciate, like the fact that PHP is so easy to deploy that most cheap shared hosts deploy it as a matter of course, and the fact that it runs really fast. Others are more subtle. There are enormous user communities centered around user-focused, PHP-based toolkits like Wordpress and Drupal. Ruby and Python just don't have these yet, but that may just be a question of time. The Drupal community is now huge, but it took nearly eight years to get to this point. There are a few Ruby and Python-based projects which aim to be the equivalent of Drupal (everybody wave to the Insoshi folks!), but they're only a year or two old.
Which is too bad, because Ruby is so much more satisfying than PHP. The future cannot arrive soon enough.
Plus I'd like to hear differing opinions, especially since PHP tends to bring such heated debates.
But I always wanted to do one.
"Solving the web problem" means nothing unless we can define what the problem is. If the problem is to quickly push out a dynamic page, then PHP is good, at least as good as ASP or JSP in their PHP-ish mode.
Its adoption rate also shows it's a good solution to the "push dynamic pages out" problem, but there are at least two angles to this problem: the point of view of the programmer and the point of view of the server manager. I suspect the adoption rate has a lot to do with the availability of "US$ 2.99 hosting" options, most of which offer PHP. So, it can be popular both because it's a really good option, because it's dirt cheap or a combination of both.
You emphasize the rapid results thing, which is good - if the larval programmer doesn't get some feedback, he or she won't stay interested long enough to learn. But there are other ways of giving feedback - a GUI, for instance. Or printing to the console. No web is required here except for the reason PHP is web-centric.
And then, there are the structural problems with PHP. No namespaces, too much magic in type conversions and so on. Believe-me: I have seen a generation of programmers lost because they were poisoned by Clipper and then by VB. They never really recovered. Maybe ther never will.