By bloid
via codinghorror.com
Published: May 21 2008 / 13:34
I remember my first experience with PHP way back in 2001. Despite my questionable pedigree in ASP and Visual Basic, browsing an alphabetical PHP function list was enough to scare me away for years. Somehow, perusing the above list, I don't think things have improved a whole lot since then.
Comments
daniel replied ago:
It doesn't matter because tools (in the sense of supporting infrastructure applications like Apache) are a very significant factor in language choice. For the same reason that Java will remain dominant over Scala for a long, long time to come, PHP will remain dominant over just about everything for the small-scale web application.
cbang replied ago:
> small-scale web application
Digg, Facebook, Wordpress and YouTube are small-scale web applications? Hmm.. because you do not have to mess with web.xml, context.xml, faces-config.xml etc? ;)
Tantalus replied ago:
Yes, exactly. As a language it's terrible, but it has other advantage that keeps it in use. And it being kept in use leads to more people able to polish apps like WordPress etc. It doesn't matter to the overall point, but youtube is written in python, not php.
"why is it powering so much of the internet"
It would be better to ask this about say, mysql. PHP doesn't 'power' much. What you want to know is why it's displaying so much of the internet. PHP may arrange the presentation of Facebook or wikipedia or whatever, but it's 'powered' by massive database and memcached and perlbal and similar.
rockstar101 replied ago:
No matter how much you want to say it (and you make a point of coming into every PHP thread and saying it), PHP is not a terrible language. It has elements in it that make it easy for beginners to use and it has elements that let you build the most complex websites imaginable. IMO, that is the exact opposite of terrible.
Tantalus replied ago:
But what I also say every time that is often missed is that this is OK -- just because a language is terrible doesn't mean it can't be useful. For example, as you state, for hobbyists it is nice and has a low curve to get something up on their godaddy account or whatever.
cbang replied ago:
> youtube is written in python, not php.
Umm well it can't possibly be entirely Python. Check their main API (http://code.google.com/apis/youtube/developers_guide_php.html) or look at the URL of a video (http://youtube.com/my_videos.php)
Also, not sure about your MySQL comment. Java environments will soon be bombed with MySQL propaganda by Sun and Google (a massive content contributor) has almost no database at all.
I think the power of PHP comes from the fact that it's easy to mock things up and get the job done. And the paradigm is very simple, there's very little configuration, training or pattern knowledge involved.
Tantalus replied ago:
might have started with php for display, but a url extension means nothing. exposing an api to php doesn't mean you app logic is written in php. watch the presentation cuang do gave, or the other guy there, they talk about python being the language for all app logic.
mysql i mentioned because it's a technically inferior product that until recently was an absolute toy rdbms that gained wide adoption for reasons other than its quality as a database, and it powers a lot of sites on the internet.
mark.t replied ago:
To all the Ruby fanboys and Web designers: Keep talking about PHP and Java, we love it ;)
Gregg Bolinger replied ago:
"And the paradigm is very simple, there's very little configuration, training or pattern knowledge involved"
Which is why there are so many PHP code bases that are a nightmare.
legendx replied ago:
Can someone explain why having a lot of functions beginning with the letter A is evidence of a bad programming language?
Tantalus replied ago:
One issue at hand is that PHP can not reuse names, so if I want to include something to parse xml and something else to parse say, json, i have to give them different names besides 'parse', because PHP until just now has had no namespaces, unlike every other modern language in the world. This is why you have stuff like some_long_prefix_to_fake_a_namespace_and_please_god_avoid_collisions named functions.
Furthermore, some of that sprawl is from functions that are useless because they do basically the same thing as some other function, or are an old broken version of some new function and haven't been taken out, and are inconsistently named, etc. I mean, this is all documented stuff.
So it's not just 'a lot of functions are bad' per se, but that it's a sign of other sloppyness or brokenness in PHP's design and implementation.
Paddington_Bear replied ago:
Great article. Although I like PHP I agree the language is only as good as the person that writes the code.
vladocar replied ago:
I too started with ASP and get scared of PHP C like syntax but then ASP.NET come and I was even more scared. Then I descovered ColdFusion easy and logical syntax but very very expensive hosting.Then I learned PHP, now I love PHP ;)
ancestor replied ago:
I don't think PHP is a bad language. It has his quirks, of course, but the main problem arises from being easy to learn and produce something with it, and tends to attract a whole lot of bad programmers. But hey, you can find crappy code in just about any language - the difference is, most people can spot crappy php code a mile away.
roshanbh replied ago:
It's not the programming language, it's the coder who makes it bad. I'm using PHP and love it. If you're a good coder you can make the bad programming language good but telling bad to a popular programming laguage doesn't make you great.
mark.t replied ago:
That's why PHP or Java developers don't even bother to get into this discussions with Ruby web designers, the truth is that they don't know much about programming. The same happened in the 90's with Visual Basic programmers. They are like cheerleaders, jumping and singing naked without even knowing who's playing.
Voters For This Link (27)
Voters Against This Link (12)