I <3 Steve McConnell*
Coding Horror
programming and human factors
by Jeff Atwood

May 20, 2008

PHP Sucks, But It Doesn't Matter

Here's a list of every function beginning with the letter "A" in the PHP function index:

abs()
acos()
acosh()
addcslashes()
addslashes()
aggregate()
aggregate_info()
aggregate_methods()
aggregate_methods_by_list()
aggregate_methods_by_regexp()
aggregate_properties()
aggregate_properties_by_list()
aggregate_properties_by_regexp()
aggregation_info()
apache_child_terminate()
apache_get_modules()
apache_get_version()
apache_getenv()
apache_lookup_uri()
apache_note()
apache_request_headers()
apache_reset_timeout()
apache_response_headers()
apache_setenv()
apc_add()
apc_cache_info()
apc_clear_cache()
apc_compile_file()
apc_define_constants()
apc_delete()
apc_fetch()
apc_load_constants()
apc_sma_info()
apc_store()
apd_breakpoint()
apd_callstack()
apd_clunk()
apd_continue()
apd_croak()
apd_dump_function_table()
apd_dump_persistent_resources()
apd_dump_regular_resources()
apd_echo()
apd_get_active_symbols()
apd_set_pprof_trace()
apd_set_session()
apd_set_session_trace()
apd_set_socket_session_trace()
array()
array_change_key_case()
array_chunk()
array_combine()
array_count_values()
array_diff()
array_diff_assoc()
array_diff_key()
array_diff_uassoc()
array_diff_ukey()
array_fill()
array_fill_keys()
array_filter()
array_flip()
array_intersect()
array_intersect_assoc()
array_intersect_key()
array_intersect_uassoc()
array_intersect_ukey()
array_key_exists()
array_keys()
array_map()
array_merge()
array_merge_recursive()
array_multisort()
array_pad()
array_pop()
array_product()
array_push()
array_rand()
array_reduce()
array_reverse()
array_search()
array_shift()
array_slice()
array_splice()
array_sum()
array_udiff()
array_udiff_assoc()
array_udiff_uassoc()
array_uintersect()
array_uintersect_assoc()
array_uintersect_uassoc()
array_unique()
array_unshift()
array_values()
array_walk()
array_walk_recursive()
ArrayIterator::current()
ArrayIterator::key()
ArrayIterator::next()
ArrayIterator::rewind()
ArrayIterator::seek()
ArrayIterator::valid()
ArrayObject::__construct()
ArrayObject::append()
ArrayObject::count()
ArrayObject::getIterator()
ArrayObject::offsetExists()
ArrayObject::offsetGet()
ArrayObject::offsetSet()
ArrayObject::offsetUnset()
arsort()
ascii2ebcdic()
asin()
asinh()
asort()
aspell_check()
aspell_check_raw()
aspell_new()
aspell_suggest()
assert()
assert_options()
atan()
atan2()
atanh()

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.

I'm no language elitist, but language design is hard. There's a reason that some of the most famous computer scientists in the world are also language designers. And it's a crying shame none of them ever had the opportunity to work on PHP. From what I've seen of it, PHP isn't so much a language as a random collection of arbitrary stuff, a virtual explosion at the keyword and function factory. Bear in mind this is coming from a guy who was weaned on BASIC, a language that gets about as much respect as Rodney Dangerfield. So I am not unfamiliar with the genre.

Of course, this is old news. How old? Ancient. Internet Explorer 4 old. The internet is overrun with PHP sucks articles -- I practically ran out of browser tabs opening them all. Tim Bray bravely bucked this trend and went with the title On PHP for his entry in the long-running series:

So here's my problem, based on my limited experience with PHP (deploying a couple of free apps to do this and that, and debugging a site for a non-technical friend here and there): all the PHP code I've seen in that experience has been messy, unmaintainable crap. Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places.

Tim's article is as good a place to start as any; he captured a flock of related links in the ensuing discussion. As you read, you'll find there's an obvious parallel between the amateurish state of PHP development and Visual Basic 6, a comparison that many developers have independently arrived at.

Fredrik Holmstrm:

Every solution I've ever seen or developed in PHP feels clunky and bulky, there is no elegance or grace. Working with PHP is a bit like throwing a 10 pound concrete cube from a ten story building: You'll get where you're going fast, but it's not very elegant. ... I love PHP, and it's the right tool for some jobs. It's just an ugly, cumbersome tool that makes me cry and have nightmares. It's the new VB6 in a C dress.

Karl Seguin

From my own experience, and the countless of online tutorials and blogs, many PHP developers are guilty of the same crap code VB developers were once renowned for. OO, N-Tier, exception handling, domain modeling, refactoring and unit testing are all foreign concepts in the PHP world.

Understand that as a long time VB developer, I am completely sympathetic to the derision you'll suffer when programming in a wildly popular programming language that isn't considered "professional".

TIOBE index, may 2008

I've written both VB and PHP code, and in my opinion the comparison is grossly unfair to Visual Basic. Does PHP suck? Of course it sucks. Did you read any of the links in Tim's blog entry? It's a galactic supernova of incomprehensibly colossal, mind-bendingly awful suck. If you sit down to program in PHP and have even an ounce of programming talent in your entire body, there's no possible way to draw any other conclusion. It's inescapable.

But I'm also here to tell you that doesn't matter.

The TIOBE community index I linked above? It's written in PHP. Wikipedia, which is likely to be on the first page of anything you search for these days? Written in PHP. Digg, the social bookmarking service so wildly popular that a front page link can crush the beefiest of webservers? Written in PHP. WordPress, arguably the most popular blogging solution available at the moment? Written in PHP. YouTube, the most widely known video sharing site on the internet? Written in PHP. Facebook, the current billion-dollar zombie-poking social networking darling of venture capitalists everywhere? Written in PHP. (Update: While YouTube was originally written in PHP, it migrated to Python fairly early on, per Matt Cutts and Guido van Rossum.)

Notice a pattern here?

Some of the largest sites on the internet -- sites you probably interact with on a daily basis -- are written in PHP. If PHP sucks so profoundly, why is it powering so much of the internet?

The only conclusion I can draw is that building a compelling application is far more important than choice of language. While PHP wouldn't be my choice, and if pressed, I might argue that it should never be the choice for any rational human being sitting in front of a computer, I can't argue with the results.

You've probably heard that sufficiently incompetent coders can write FORTRAN in any language. It's true. But the converse is also true: sufficiently talented coders can write great applications in terrible languages, too. It's a painful lesson, but an important one.

Why fight it? I say learn to embrace it. Join with me, won't you, in celebrating the next fifty years of glorious PHP code driving the internet. Just don't forget to call the maintain_my_will_to_live() PHP function every so often!

Posted by Jeff Atwood    View blog reactions
« Twitter: How Not To Crash Responsibly
OpenID: Does The World Really Need Yet Another Username and Password? »
Comments

Is it not possible to introduce concepts like N-Tier, Unit testing, frameworks to PHP?

I don't think the problem is with the language, but with the communitiy. I like the ASP.NET community more that PHP's. Because PHP''s community seems to be dominated by many "scriptkids" hobbying in in their basements. As a result, there are a lot of bad code examples on the net on PHP. Whereas ASP.NET enjoys much more professional community.

Matthijs on May 21, 2008 4:10 AM

@Matthijs

Have you been living under a rock the last 5 years?
This stuff is all available in PHP5.

Just to name a few main stream frameworks:
CakePHP
Symfony
Zend Framework

The unit testing suit for PHP is created by Sebastian Bergmann.

N-Tier is a way of building applications. It should not be build in a language. It's something you should be able to create with any language available.

As far as the function naming goes. i agree. It's a mess. And even the parameter order for the functions are mixed. Like reversing the needle and haystack. But that doesn't cause bad code to be written. I've been a web developer for the past 10 years. And have seen my fare share of bad coding. Not only in PHP. This has nothing to do with the language. It's because PHP is a trend. So everybody jumps on the bandwagon.

This phrase made me smile though :)

PHP isn't so much a language as a random collection of arbitrary stuff, a virtual explosion at the keyword and function factory.

Thijs on May 21, 2008 4:22 AM

Listen to what inventor of php Rasmus Lerdorf thinks...

http://itc.conversationsnetwork.org/shows/detail3298.html

Edward on May 21, 2008 4:24 AM

What is wrong with wanting beauty for beauty's sake? It is good to have languages and tools that do not make you queasy all the time! For the reasons you mentioned, I am glad that I do not have to use PHP on a regular basis.

That being said, I do find that I can accomplish a lot in PHP with just a few lines of code. It just always feels like an ugly solution.

Vadim on May 21, 2008 4:28 AM

Facebook’s written in PHP too, I think.

Paul D. Waite on May 21, 2008 4:29 AM

PHP's lack of namespacing from the beginning is probably a major downfall, but you can go too far the other way if you're not careful (just look at the sheer size of Java and .NET's respective runtimes). Namespacing has a tendancy to encourage growth, especially if it's nice and extensible.

Hopefully PHP 5.3/6 will strike a balance here, though.

Personally, I know that nice, structured, designed code can be written in PHP (it's what I do for a living, and I know I'm not alone in that), but I don't tend to go posting code snippets in forums asking for help. None of this is because I'm an experienced PHP programmer, of course, but because I'm an experienced programmer in general—PHP's biggest failing was giving novices who didn't know better enough rope to hang themselves.

Mo on May 21, 2008 4:30 AM

> Facebook’s written in PHP too, I think.

Paul -- thanks. I knew I forgot a big one in there somewhere. Added.

Jeff Atwood on May 21, 2008 4:39 AM

I always thought Youtube was built with Python not PHP.

lubos on May 21, 2008 4:41 AM

Mo:
"PHP's biggest failing was giving novices who didn't know better enough rope to hang themselves."

While I agree that it is a problem giving novices the rope to hang themselves, I believe that this is actually a symptom of an even bigger failing: PHP presents developers an inconsistent environment, because things can be toggled on and off by INI settings.

Magic quotes is a good example here. It's on by default in php.ini-dist and off by default in php.ini-recommended. This means that people who learned on one are going to get it wrong on the other, leading to SQL Injection attacks.

Of course, the correct way for experts to handle it is the use of the magic_quotes_gpc() to see what the current setting is and handling it appropriately.

Another symptom of the same problem is that you cannot rely on anything but the most basic of functions to be present, as most can be turned off at the edit of an ini; either by module by commenting out the module's name or by function using the disable_functions setting.

Powerlord on May 21, 2008 4:41 AM

One huge advantage php has over .NET is the transparency and editability of the source code to front end developers.

Working on a PHP site I can dive in knowing little more than to comment out " and ', and can make changes to id's, divs etc without having to know the language.

However, working on the front end of a .NET site you either have to constantly bother the back-end developers to alter the source for you, or learn a fair bit about the relationships between the controls and the html they output.

If you care about back-end and front-end developers being able to work seamlessly together then php definitely helps.

Rhys on May 21, 2008 4:45 AM

"And I just found out (after everyone else probably :-) that YouTube is
almost entirely written in Python. (And now I can rub shoulders with
the developers since they're all Googlers now... :-)"

Guido van Rossum
http://mail.python.org/pipermail/python-dev/2006-December/070323.html

python on May 21, 2008 4:46 AM

@Mo - Like I said, I'm sympathetic because of my background in "non-professional" languages like Basic, but PHP is almost pathologically bad! Here's one example:

http://www.bitstorm.org/edwin/en/php/
--
Some function names consist of more than one word. There are three conventions for combining these words:

1. Glued together: getnumberoffiles
2. Separated with underscores: get_number_of_files
3. Camel case: getNumberOfFiles

Most Languages choose one of these variants. PHP uses *all* of them.
--

Jeff Atwood on May 21, 2008 4:46 AM

> YouTube is almost entirely written in Python

http://youtube.com/results.php
http://youtube.com/my_videos.php
http://youtube.com/my_account.php

It is believed that Guido is referring to the YouTube backend. It's also possible Google forced a rewrite, as I don't believe they support PHP on their server farms.

Jeff Atwood on May 21, 2008 4:47 AM

The problem is php originally stood for Personal Home Page. And you can see that in the design. They have been adding one layer of functions on top of the other. This doesn't make it a bad language. It just makes it a badly designed language. If you compare it to C# or others. You don't get the feeling of consistency. Especially when you go into the OO interfaces.
Personally, I used it for big projects because it was the only real thing around a few Years ago. Today I would never put up with this mess. I shouldn't have to care about what SQL backend I use. Even with Cake it is just another layer on the onion.

ribalba on May 21, 2008 4:53 AM

I liked this...

http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

The guy learned MVC using rails but didn't like all the "magic" rails does under the covers so he switched back to PHP and re-wrote his app properly.

adrian_m on May 21, 2008 4:53 AM

I remember the Facebook code leak, which is also coded in PHP. The code was clean and well-engineered.

It's only a matter of who is programming. You just need some discipline.

Vincent on May 21, 2008 4:54 AM

Good post. At least an interesting read. I've been a PHP dev guy on and off for a couple of years now, and I'd just like to point out that I think a distinction needs to be made between a languages ABILITY to be written in nice, neat, OO style, and the general trend of developers who CHOOSE NOT to write it that way.

Bet I can write some C, Java, Ruby, or Perl that looks way uglier than most of the PHP you've seen - that is, if we're nitpicking the way code looks.

Chris on May 21, 2008 4:57 AM

While I was a bit offended by the fact that saying a programmer with even an ounce of talent would find that PHP sucks basically translates to that I must suck because I don't think PHP sucks... I can let that pass, since I'm sure it wasn't your intention to offend anyone ;)


Anyway, while it's true that a lot of PHP code sucks, it's definitely caused by - as highlighted by the other commenters too - the fact that most PHP programmers are hobbyists and "amateurs". I can admit that I was one as well, and my PHP code was as bad as anyones. Today it's a different story, though, as I've actually been coding for so long and in different languages, read books (incl. some that are on your recommended reading list) and so on...

I really like languages like C# and Python, but I can't say that PHP sucks. I've been coding in PHP for over 6 years, which makes it the language I've been using actively for the longest time. After you've been working with something that long, it all actually starts to make sense - but I think that PHP's problems, such as function naming and parameters being inconsistent, and the problems they cause are exaggerated a lot.

Jani on May 21, 2008 4:58 AM

I agree with the first part, not so much with the second. Why do I think that my opinion matters? Because less than half a year ago, I've consciously chosen PHP for a web application framwork I've built. All things considered, PHP was the right choice for the job and the resulting application works very well, has a very clear architecture, is extensible, efficient, separates concerns, models MVC, and generally does all the Good Things that you'd want in an application.

And still, PHP sucked. And it DID matter. A lot. How did it matter? I claim that, had the language been better designed, writing the application would have taken half the time. That's right, half the time. Costing half the money. Which, for a small start-up, is a lot.

Saying that “it doesn't matter” seems awfully cynical. Of *course* it matters and I very much regret that I had to spend any time whatsoever working with that defective tool. The thing is, one of the biggest reasons to use PHP (and the main reason we used it) is its wide spread. If you want to run your application anywhere, you've got no choice but PHP. This actually makes me quite mad: I'm mad in part at the inertness of the internet providers who are unable to provide clearly superior tools in their services, and in equal part at the PHP developing community who expose us to such a sucky tool, and who persist in developing new versions. Guys! Give us a break, stop developing that crap and force the providers to switch to better tools!

It's easy for me to lay the blame at someone else's feet and rant at them but this doesn't my anger any less justified. PHP *is* badly designed and this fact won't change in future versions.

Konrad on May 21, 2008 4:58 AM

> building a compelling application is far more important than choice of language

PHP is cheap. The cost of entry for creating a web app with PHP is something like $1.99 a month + a domain name. You could probably create Digg by copy-and-pasting code snippets found around the web.

If you have an idea, PHP gives you a quick and dirty 1.0 (a la 37signals) implementation for cheap.

My question is how people let a profitable version 1.0 turn into a bloated spaghetti-code 2.0 without at least considering a more elegant and robust language.

Eric DeLabar on May 21, 2008 5:00 AM

The problem with say, cleaning up the functions and putting them into the right namespaces and libraries, is of course that you're going to break legacy apps - unless you allow for the old functions to be used next to the new.

Then, you have to simply force everyone to rewrite their tutorials and books; because when a function is aliased, it does not scream "I AM DEPRECATED, STOP USING ME YOU IDIOT", so people will just use the old one.

Simply by showing that message in a bright red bold font, I'm sure you could solve issues really quickly ;). ASP.Net truly crashes and burns with its Yellow Page Of Death; while it's really handy sometimes that PHP doesn't, it also allows the programmer to be a bit more lazy.

Oh yeah, either make the links of the functions point to something useful, or remove them and just color the font - right now every single one of them links to your archive ;).

Rob Janssen on May 21, 2008 5:05 AM

http://video.google.com/videoplay?docid=-6304964351441328559 re: the youtube architecture. They switched to python a long time before google came knocking. They also use C. But i'm not nitpicking because for the most part you are right.

PHP has its abilities, no doubt. However PHP's ability to scale - code length wise, is just not right. The later PHP's are definately getting better. But look at PHP3. It gets messy quick and thats just the nature of it.

I dunno. I'm sick of these debates.

Mike Scott on May 21, 2008 5:07 AM

> My question is how people let a profitable version 1.0 turn into a bloated spaghetti-code 2.0 without at least considering a more elegant and robust language.

Yes, I can't possibly imagine how that would happen!

http://www.codinghorror.com/blog/archives/000256.html

Jeff Atwood on May 21, 2008 5:07 AM

I love PHP. I don't know why people don't like it, but I don't use the frameworks of the day and engineer everything myself, so my code is elegant and there's an easy transition to blocks when coming from Java and for some reason I just love weak/dynamic typing when working on the web (everything IS a string in the end).

Scott Preston on May 21, 2008 5:08 AM

I have to disagree a little bit. Right now I am working on a small website and a backend admin interface for a local theatre. I have never worked with PHP before and I am learning all the time. I use the Code Igniter framework and the experience has been quite pleasant so far. Example from one of the "views", that produce HTML output from data supplied by the controller:

| if ($acts->num_rows () > 0)
| {
| function acts_to_str ($i)
| {
| return anchor ("admin/play/show/{$i->play_id}", $i->title);
| }
|
| entry ('Acts in',
| ul (array_map ('acts_to_str', $acts->result ())));
| }

This will produce an <ul> list of plays an actor shows in, if any. I think this is quite nice. Forms work in a similar way.

| field ('Description',
| form_input (array (
| 'name' => 'description',
| 'value' => $this->validation->description,
| 'size' => 50
| )),
| $this->validation->description_error
| );

Yes, some programmers can write FORTRAN in any language. I also came to the conclusion that it is possible to write LISP in almost any language. You may then object why not use LISP in the first place. Well, it is not always possible. This particular client has very tight budget and cheap hosting in my country (Czech Republic, but I suspect this is the same everywhere) means MySQL and PHP.

Keo on May 21, 2008 5:10 AM

Has no one else seen the rails crap that is in some of the open source projects? Jeff you are correct, you can write crap in any language despite best intentions.

Imagine most novices trying to write a web application without rails or a framework - thats what most php developers are doing. Its quite an impressive feat when you think about it, what other language is so simple to prototype in? With rails you have to go through many, many more steps to get a hello world, and most non-developers won't bother.
Plus, php is installed on every server on the planet.

php on May 21, 2008 5:11 AM

Make your PHP suck less using this miniscule (60 line) MVC engine; I've used it to develop the web UI on an embedded device manufactured by Cisco, for TimeWarner:

http://code.google.com/p/barebonesmvc-php/

George Jempty on May 21, 2008 5:13 AM

What personally makes me laugh in my mind is how everyone always says how PHP is so badly designed etc., but never can actually show how it slows down their app development. I think PHP's manual is stellar, and it's very easy to find a function for the job and its parameters and such...

No one has really been able to properly argument *why* it is that PHP sucks. The usual issues are always:

- Magic quotes and register globals: anyone who knows what they're doing can turn them off.

- Function naming: while they may be a bit inconsistent, the functions for a specific area (like array manipulation) do follow conventions ok and should not pose a problem for a talented guy (the manual as I mentioned, a good IDE will show the params etc.)

- It just sucks: omigosh, really? =)

Jani on May 21, 2008 5:16 AM

What? Oy! That hurts. I guess now I know how it feels to be a fan boy (or perhaps zealot).

Perhaps it is due to my inexperience with other web languages (with the other being the ASP.NET) but I wouldn't call it a bad language. Certainly, as bad as PHP scripts are, I've seen nightmare code born out of undergrads doing ASP.NET. One might argue that's the undergrad's fault and that they are not really programmers but people using WYSIWYG.

And I argue PHP has the same problems. It's easy enough in that you can hack something up and it works, and given the surge of internet pages, these people may not even be interested in anything but getting the job done. Skip OO theory. Heck, they might even skip functions as merely being "useful". That's why there's ugly perl. And that's why (probably) there will be ugly code for all the new and hip languages (once it get popular enough)

I don't see why good code can't be written in PHP even by just someone who learned proper programming concepts. It's just that PHP is too mainstream. It's the myspace of server side scripting. Perl is probably livejournal. Python and Ruby is probably Facebook or Pownce. (Metaphor falls apart because it suggests there's a lot of functionality differences).

Those who are really interested in programming flock to the 'fun' new languages. Those who left are those who probably don't bother improving themselves and newbies.

I suppose I should be showing pure coding examples, and this may just be irrelevant but I do really think that PHP is not bad and I kind of like it. And maybe I'm just a little nutty and that I love programming so much that I even like the worst one.

M. Firdaus on May 21, 2008 5:18 AM

>> Notice a pattern here?

Yes, but not your one.

PHP hosting is free and everywhere, that's why we see so much PHP apps out there. Now take Python, Lisp, Ruby, Haskell, etc. web apps and you'll have to pay for hosting.

Wikipedia, Digg, Wordpress can easily be done in thoses languages too (even with a clearer code I suppose). We only have to wait to see free hosting companies supporting these languages and PHP will not stay on top for sure!

kib2 on May 21, 2008 5:21 AM

Who learns a language by reading an alphabetical listing of the API?? That's like reading the phone book to learn how to dial a phone. Let's print out the Win32 API's while we're at it. There is a division between API and the language itself. In PHP's case, they're fairly tightly coupled. But it is possible to write PHP without any API calls, it just won't do very much.

The only thing that sucks about PHP is that the barrier to entry is low and the rules are very relaxed. So you get a lot of folks that are barely programmers writing code that Just Works and Smells Bad.

Paul on May 21, 2008 5:23 AM

I think that the problems with the PHP language itself are greatly overshadowed with the quality of code coming out of the community. I'm a professional PHP developer and I have seen a lot of truly awful code written in the language, but I also know it is not hard to right elegant, beautiful solutions.

Stuff like function naming is awful, true, but day-to-day I'm much more likely to be interacting with well designed classes and objects than directly with those functions.

I believe it is the number of amateurs using it that gives us the comparisons to VB rather than the language design itself.

A bit of discipline, keeping to one class per file, putting everything you possibly can in a class, etc. can make PHP a joy to work with. I certainly prefer it to Java, Perl, C++, VB, Ruby... and the languages I do like (C, C#, JavaScript) are simply not as appropriate for the domain as PHP.

Mat Scales on May 21, 2008 5:27 AM

@Paul
> Who learns a language by reading an alphabetical listing of the API??

Familiarising myself with a language's API and object model is one of the first steps I take towards learning a new language.

Is that just me?

Joe on May 21, 2008 5:27 AM

"""
> YouTube is almost entirely written in Python

<a href="http://youtube.com/results.php">http://youtube.com/results.php</a>
<a href="http://youtube.com/my_videos.php">http://youtube.com/my_videos.php</a>
<a href="http://youtube.com/my_account.php">http://youtube.com/my_account.php</a>

It is believed that Guido is referring to the YouTube backend. It's also possible Google forced a rewrite, as I don't believe they support PHP on their server farms.
"""


Let's leave aside the fact that having an url ending with .php doesn't prove anything wrt/ the underlying techno - FWIW, I've maintained a mixed .php / .html url space on my wife's website for 2 full years after migration from a Q&D php solution to a Zope-based one. The point is that the OP wrote that YouTube was "*almost* entirely" written in Python - so what's the point of collecting three urls from the front-end that may - or not - be still in php ?

wrt/ the "forced rewrite" argument, I just don't buy it, sorry. IIRC, Youtube being *mostly* written in Python was public knowledge before Google bought Youtube.

bruno on May 21, 2008 5:29 AM

@Jeff - so I take it you WON'T be using PHP for your new site? You'll be sticking with VB.NET? ;-) I mean Visual Basic 2008...?

VBMan on May 21, 2008 5:31 AM

PHP was crufted together over time and it shows, that's why it is inconsistent, yes it is badly designed, and so it is easy to write terrible code, but it is easy to write terrible code in C, C++, Basic, VB etc ...

So why is it popular?
Because it is a scripting language - No compiling, instant feedback
Because it is forgiving - Aliased old function names, compatabilitt settings etc ...
Because it is simple at first - Like VB it is easy to write simple programs, there is not steep learning curve

All of these attract amateurs, who try and be helpful to other amateurs and so there are loads of 'Getting started' pages and cut'n'paste code samples which give the impression of an amateur language, PHP5 is moving away from this ... slowly ...

Jaster on May 21, 2008 5:36 AM

It's another example of the Worse is Better principle, I believe. The tool the majority uses might not be the best for the job, rather it's the tool these people are the most comfortable with.

Delmania on May 21, 2008 5:39 AM

I like PHP because there is no impedance mismatch to get your idea up and running. PHP has been around long enough such that its supported in virtually every webserver. There is no compilation involved, just create a page and go.

monsur on May 21, 2008 5:39 AM

@jeff

I agree the function naming in PHP is very bad. But it's legacy. And very hard to change and keep backwards compatibility. However camelCase naming is not used in the PHP function names. It's either a complete phrase or _ separated words. In PHP 5 some core objects were added like Date, Reflection, etc. These do use camelCase naming for the methods.

The example comes from <a href="http://www.bitstorm.org/edwin/en/php/">http://www.bitstorm.org/edwin/en/php/</a>. But i think it's more about case sensitivity then actual function naming.

By the way some of the functions you named in the a* list. Are not core functions. They only become available when loading the extension. This doesn't really have anything to do with your article. But i thought i would provide you with this info anyway. The ArrayIterator methods are not functions. they are object methods. And i guess here you can see a trend in "new" naming convention. All are camelcase.


Thijs on May 21, 2008 5:41 AM

I love PHP =(

=( on May 21, 2008 5:44 AM

The other correlation of your PHP examples is that none of them matter.

I'm quite serious - if any of those sites has an outage, it's annoying, but it isn't mission-critical to anyone. They're barely more than technology demos. If a comment was missing from Digg, who would know? If a page was missing from Google's index, who, apart from the site owner, would know? These systems are error-tolerant in that no-one knows that there is an error.

Over on CodeProject - now rewritten at considerable expense in ASP.NET - we have a community largely of professional programmers that bitches loudly any time they receive an error. There tends to be high visibility of any problems.

Mike Dimmick on May 21, 2008 5:48 AM

A lot of people do use it as a frontend, all right. I tend to suspect that its current prominence is more of a fad than anything else, though; when you look at it first it looks very easy, and webhosts tend to support it. It's a bit of a mess actually writing anything big in it though... It's not a horrible templating system, but once you start doing anything else, things get nasty.

A lot of Facebook's backend is in C++, Java, Python, Erlang and other things, apparently, by the way.

Robert Synnott on May 21, 2008 5:48 AM

My rule of thumb is use php for anything up to but not including login functionality (if your hiring someone to do it). An Average .net dev still costs 40% more than a really good php dev in my experience.

Scott Cowan on May 21, 2008 5:50 AM

Oh, besides that, it has no closures, no namespaces and very weird scoping. Urgh.

I used to use it, by the way; it seemed like a simpler way to write websites than C++ or Java, and I never could stand Perl. Python and Common Lisp were _such_ a revelation.

Robert Synnott on May 21, 2008 5:51 AM

@VBMan Jeff said he'll use ASP.NET Ajax and it's MVC framework for StackOverflow.

Also, nice one, Jeff. This is exactly why I don't like PHP.

KTamas on May 21, 2008 5:52 AM

@Mat Scales

"I believe it is the number of amateurs using it that gives us the comparisons to VB rather than the language design itself."

I don't disagree with that statement, put a shitty programmer in front of C# and his code will be shitty. But PHP itself is full of poor usage - extremely limited use of exceptions, limited use of OO, no sensible framework baked into overall product. I've programmed in CakePHP and it's a joke when compared to other MVC + ActiveRecord patterns. Even so, I'd take CakePHP as a pretty big step up, but the adoption seems to be fractions of the PHP community. (Akelos seems like a much better implementation, but it's adoption is even worse.)

karl on May 21, 2008 5:53 AM

I don't think this applies to PHP only. The .Net framework is probably as inconsistent (in it's own way) as the PHP framework (the language itself isn't that bad, actually). The core of the problem is a functionality overload: there's a function (or class) for about anything. And it's hard to remember all of those.

The major difference between PHP and .Net (for example) is that the .Net framework has an excellent toolset available which migitates a bit of that functionality overload: Visual Studio (Express) and Intellisense. While PHP has those too, they're a lot less visible and available than Visual Studio. In fact: it's harder to start developing an ASP.Net site without Visual Studio than with Visual Studio (even for experts).

So while I agree with Jeff's post, I think there's more to it than he claims.

Inferis on May 21, 2008 5:56 AM

Oh, and no sensible Unicode support. How many modern languages, especially languages targetted towards the Internet, can you say that of?

Robert Synnott on May 21, 2008 6:00 AM

@Rhys
oh ffs... What kind of developer are you talking about?! You can go on a rampage and blindly dump every .net control into an application and don't care about the html code it generates... But it is lousy programming and it gets you to great examples of brainfuck code (http://en.wikipedia.org/wiki/Brainfuck#Commands) in any language!

Wafflecop on May 21, 2008 6:01 AM

One of the problems is that even some of the more well known PHP frameworks are kinda crappy... like karl mentioned CakePHP. That makes everyone who does not bother digging a bit deeper, or those who haven't really looked into PHP for a while, think it's a bad language that can't be used to make anything nice.


There are seriously good frameworks too. Zend Framework combined with Doctrine ORM are a *major* win. They have some very talented people behind them.


Btw, if you listed all the classes/methods from the .NET Framework which begin with A, I believe it would be quite confusing =)

Jani on May 21, 2008 6:02 AM

PHP hosting is cheaper you know.
That is why young web developers almost always use PHP.
When the app they built gets big, it becomes a problem. Thats it.

Niyaz PK on May 21, 2008 6:06 AM

Yeah, those other guys create crappy PHP but mine is elegant and slick.

Ouch! Broke my eye winking so hard.

old fart on May 21, 2008 6:13 AM

To all the people wanting to find more Python, Ruby, etc... on cheap hosts: these hosts will only install what their customers demand. And their customers will only demand your language of choice if there's software they want to use that's written in it.

So to fix the problem, write software people want to use in the language you prefer and release it!

Joseph LeBlanc on May 21, 2008 6:14 AM

no, no and no. PHP 5 has OO and exception handling similar to java and phpunit is very similar to junit (so unit testing is not a problem, only problem is that most of the php developers don't use it).
Because PHP gives you a freedom to write your code in several ways (with php5 you can write pretty good oo stuff), it's easier to write crappy code (or fortran).
I agree about php function names, they are very inconsistent and it's annoying. One other thing i really hate is that there are no consistency about arguments: sometitmes it's func1(needle, haystack) other times it's func2(haystack, needle). Often you have to check reference just to be sure that you are using arguments in correct order.


mart on May 21, 2008 6:16 AM

There is one reflection strikingly absent from all the comments so far: why did ever PHP become the de-fact-choice of all web hosters? Well, it's because of the off-the-shelf php appz, dood! (answer B: it's because that's what the devs asked to hosters). If you go back in time 10 years, finding php hosting would not be so easy. In other terms: demand drives offer - it's just that hosting companies are slow to respond. If everybody asks for python now, they will have it cheap and easy in 5 years time.

I found the post very funny, but mostly agree with Ilia - a bad language is not such because of a humongous function collection or inconsistent parameter ordering. The online, user-commented php manual was php's gift to comp science, and by itself it solves the function naming problem.

A good language otoh makes the simple things trivial and the hard ones simple. And few things can beat php at that (and few other communities have produce such a boatload of really, really crappy code that is still good enough to run the web).

gaetano on May 21, 2008 6:16 AM

I still enjoy PHP from time to time. It's almost universally installed on webservers and if you need to make a quick web app it takes second to throw one together. Last year, I rescued a mailing list for a bar owner/friend. We created a simple 10 line query to pull the entire list into a csv file. Import into Excel and some clean up and now he's got a useable mail merge for his office.

Over the years I backed away from PHP: 1) .NET developer jobs were paying 10K+ for equivalent positions. 2) I liked the cleanliness of having namespaces and real typed variables. 3) Until PHP5, OO felt like a loosely bolted on 5th wheel. It was there but few were using it correctly or at all.

I do believe there is less noise and better coders in the .NET camp. On the freelance level I was competing for cheapskate businesses who wanted good websites but paying scriptkiddy money.
My experience has been that someone that pays for a dedicated server, IDE, and SDK is heavily invested in their idea. Anyone can get a $10/mo server that does little more than PHP and MySQL and scoff at that idea that a good developer is going to cost $1000s

Joe on May 21, 2008 6:19 AM

All programming languages suck. They just suck in different ways. The sensible programmer knows it's all about 'horses for courses' and uses what's appropriate for the task at hand.

Pascal and Ada are examples of a languages that were created to be philosophically pure. PHP and Perl are examples of languages that were originally created as duct tape to get jobs done. Oddly enough, the latter are more popular than the former, despite the objections of anal retentive purists.

Rather than bashing a language for its historical legacy, Jeff, how about you mention how you would make the best of things in PHP to produce a good PHP application. I'm sure that would benefit your readers immensely.

Pete on May 21, 2008 6:19 AM

@mart:
I think you're missing the point. It isn't that PHP doesn't have support for those - it's that most PHP developers don't leverage them nearly to their fullest potential. In fact, the PHP library itself doesn't.

Karl on May 21, 2008 6:20 AM

To both gaetano and Joseph LeBlanc, it has nothing to do with the apps. The apps exist because the hosting exists.

Apache is the defacto standard for web servers, Apache runs PHP pretty efficiently on commodity hardware. PHP is easy to install, easy to maintain, easy to deploy to, and VERY easy to host.

Java, Rails, Django (I think?), and .NET cannot make those same claims. I know personally that a Java app written to the complexity of something like Wordpress would require its own server, not something a web host is going to be very interested in hosting for $1.99 a month. Rails on shared hosting is flaky at best (anybody ever tried it on Dreamhost? Not pretty.). .NET requires MS, in theory anyway, that means licensing costs.

PHP is everywhere because it's cheap and easy for everyone.

Eric DeLabar on May 21, 2008 6:26 AM

The major advantage of PHP is that you never run into something you can't do. At least I haven't. And I do all kinds of crazy stuff. Websites, Intranet utilities, it talks to everything and with very little research it just works.

Rails? Ha! Waste of time. Only if you want to write nothing but blogs and demos (which most do). Sure it makes the designers happy, but I am not a designer. I want to do MORE.

Python is a fine alternative. I think it's practically the same language with different syntax.

But yes, it is inelegant. Very inelegant. And how elegant your code is—is totally irrelevant.

Jeff Davis on May 21, 2008 6:27 AM

functions are not part of the language, if you don't like the functions name, it doesn't mean that the language is not good.
It's like complaining that C is a bad language because of the standard library, use your own functions, name them what you want.
I find PHP a great language.

Petruza on May 21, 2008 6:28 AM

As Bjarne Stroustrup once said "There are only two kinds of languages: the ones people complain about and the ones nobody uses."

Roger on May 21, 2008 6:29 AM

PHP is simple and fast. In many ways, due to the awesome online reference, it's easier to figure out how to do complex things with PHP than with other more popular technologies like JSP/ASP. Also, due to the RAD design of technologies like ASP.Net (which I have done professionally since it was in beta), they are slow and clunky. Sure, if you avoid using postbacks and the control tree, you can reach the same performance levels PHP provides, but I rarely see that done. Because PHP writes directly to the response stream still like old ASP did, it encourages the old coding styles which in turn gives better performance. PHP's lack of packages/namespacing is indeed a problem, but the only way to get rid of that is to fork the project into PHPlus or something like that, and organize all of the functionality into logical groups, standardize naming conventions, and re-release it with a converter program that will convert old PHP to the new PHP. Without a converter, it would be doomed to fail.

Justin on May 21, 2008 6:30 AM

Dear Jeff,

PHP started as a language designed to add flexibility for serving HTML content on http calls. One http call = one run. This means for the complex web applications we are using now: you basically need to re-initialise the whole application on each call in one state, bring it to another state, output content and save the state, if necessary. This is inefficient. AJAX is only haf a relief because you need not to send the whole page anymore, just the bits that change.

For me, the problem is beyound: why do developers choose with PHP an application model for the system they want to create that does not support object caching and view-based state caching in an efficient way itself? For me, application development starts before: build an abstract software model and decide then, which kind of application model suits it best. And this is something you do not usually learn when learning to program.

So long - Tobias

Tobias on May 21, 2008 6:31 AM

If in any language one can write beautiful code (with that I agree 100%) I wonder what makes some laguages produce sphagetti and others lead to good code.. For instance PHP and Perl tend to be maintenance nightmare, while Java and Python source code is much more maintainable.

- is it low entry barrier? (Perl has high barrier to entry)
- or too fast learning curve? (python is quick to learn)
- or maybe standard libraries influence programmers (but Java had an old collections framework that was ugly but that didn't pollute programmers' minds worldwide)

What is the reason most successful frameworks like JUnit, Spring, Hibernate happen in Java world first before being ported to .NET, Ruby, Python, PHP? Is it that majority of experts and creative people do mainly Java? Or perhaps there is something in the language that stops developers from bad practices and enforces them to seek for better solutions? Or in problem space they deal with? Or perhaps in the platform, or in the ecosystem around given language? Or in books that people start learning the language from?

So, which of these you think contain core root of the problem?

There are a lot of upcoming new languages like Groovy, Scala etc, what should focus their creators on to minimalize the risk of them evolving to another maintenance nightmare? Perhaps it would be easaier to anser "opposite" question: how to design a bad language that will result in tons of mess?

mantrid on May 21, 2008 6:32 AM

It's worth pointing out that in addition to some of the other big names mentioned above, Yahoo! also standardized on PHP some years back, and, as far as I understand, many of their properties have been built using it.

Roger on May 21, 2008 6:33 AM

The unfortunate fact of the matter is is that PHP is that is virtually on every server in the world. Why? Because its really easy to deploy with no hassle. This means that PHP is not going away anytime soon.

While I agree PHP is ... crappy (to be nice :) ... it has its ups in that the time to market for php code is extremely fast. In the past couple of weeks, I've made quick apps that work just fine with PHP. I would never create a large scale app with it, but for quick and dirty things, it's pretty ideal.

Benny on May 21, 2008 6:33 AM

The unfortunate fact of the matter is is that PHP is that is virtually on every server in the world. Why? Because its really easy to deploy with no hassle. This means that PHP is not going away anytime soon.

While I agree PHP is ... crappy (to be nice :) ... it has its ups in that the time to market for php code is extremely fast. In the past couple of weeks, I've made quick apps that work just fine with PHP. I would never create a large scale app with it, but for quick and dirty things, it's pretty ideal.

Benny on May 21, 2008 6:34 AM

There are two egregious logical fallacies in your argument. First, by attempting to use facts to make a case for the languages goodness or badness, you commit a naturalistic fallacy. PHP doesn't suck because it allows you to write function names in three different ways. It does not suck because you consider it ungraceful. It does not suck because crappy coders use it. By the same token, it does not *rock* because its used by some of the biggest web properties.

Secondly and to a lesser extent, you've got a "post hoc ergo propter hoc" (after this, therefore because of this). Just because you used what some consider to be crappy languages in the past, does not validate what you are saying now about PHP. While I can understand and appreciate the effort to "commiserate," I fell it is expressed under false pretenses.

Plus, to be perfectly honest, we PHP developers don't need it. I find PHP to be a tremendously effective language, blending all the useful parts of C, C++, Java, and Perl (which also contributes to its hodgepodge nature) to tackle the monster that is the web. I have no trouble reading it, but then again I build on the platform professionally, full-time, and write in an excessively clean fashion.

The lack of concrete evidence to support your argument, and the overriding presence of pure opinion-based references, makes your argument look like nothing more than fanboy ranting. If you're interested, I'll have a post up on my own blog to counter your arguments pertaining to the language's utility later this week.

This is two posts now where I think you've gone off the rails, Jeff. I hope you won't make a habit of this. ;-)

Frank on May 21, 2008 6:34 AM

Without reading all the other comments, and as a long time PHPer, let me first agree that PHP is messy. The reason I got into PHP was the low entry barrier. It is not a disciplined language. It's very easy to get started and thus you can find a bunch of junk code and duct-tape solutions.

But in that same stroke, getting good at PHP actually requires discipline. I'm not claiming to be a PHP guru, but I've written many, many enterprise-level web apps that have stood the test of time and that have helped many, many people. I spent time studying "good" programming practices from other languages and did my best to apply them to PHP. And it worked pretty well.

PHP is powerful and can do a lot, but that doesn't distinguish it from other languages. In fact, nothing does - shy of it running some of the most popular sites on the internet. But again, I would suggest that choice was made due to the availability (and free-ness) of PHP. It's a very low overhead language.

But I suppose in the end, what's it matter? I know it sounds like a cop out excuse, but ASP, PHP, Java...they're all just tools. Thing is that if it were not for file extensions, we wouldn't know what any web site/app uses.

I've made a nice living working PHP magic. If you actually take PHP beyond downloading and installing pre-fab software, it's extremely handy. But since it doesn't force you to learn proper programming methods, you actually have to learn them and understand them. Something you might not get from IDE and languages that do it for you.

Morning Toast on May 21, 2008 6:35 AM

Jeff - I'm having a hard time agreeing with you. I have several reasons - but keep in mind that I have limited .NET experience (I've never taken the time to learn it/use it)

I agree that PHP feels like a hodgepodge of functions that have been pieced together. However....
A couple of years back, I was using the (choirs of voices in the background) all-powerful **Java** language to code a website. The use of beans was pretty cool and I enjoyed basically having the full power of Java at my fingertips. That was when a funny thing happened. I had to handle a file upload. OMG!!! JSP had no default means to handle a simple multipart/form-data submission. I had to build a whole crap-load of header-parsing nightmare just so my users could upload a stinkin' image. What a pain. Arrays? What a joke. An array could have an int as an index but not an Integer? (they are different, of course) - 1 is not the same as 1 in Java, I suppose.

So I learned to hate Java pretty quickly. I eventually wrote version 2 of the app in PHP. My file upload problem was solved with the global $_FILES collection without any extra coding. Arrays could be associative with the same array() function and I could sort and all that.

For some reason, PHP just *feels* like it was made for the web...and only for the web. Java and .NET are like hybrids that allow me to write a web app or a windows app with the same language.

I can use a screwdriver to put in a screw and the handle to pound in a nail; but shouldn't I just use a hammer for the nail?
</bad_metaphor>

Jon on May 21, 2008 6:38 AM

PHP always reminded me a lot of classic ASP.net... not structured as well, but the way it worked and made a mess of spagetti code. ASP thankfully evolved into ASP.net, PHP is still PHP.

I've got to think it's wildly popular because it's really the best option you have for sites using Unix. You don't see very many Windows developers using PHP.

Let's at least agree that it's a step up from using Perl to create interactive websites.

Kris on May 21, 2008 6:42 AM

I meant to say "PHP always reminded me a lot of classic ASP" in that comment... not sure why I tacked .Net onto the end of it. Oops.

Kris on May 21, 2008 6:43 AM

I don't usually comment on your blog, but I read them every chance I get. Anyways, I code professionally in C# and VB.net, but I use PHP every chance I get for personal projects. Why? Because, PHP is streamlined for the web and has built-in functions for just about anything I can think of to make building a dynamic website easier.

I'm able to get a nice, cleanly written, fast and functional PHP built site in half the time that it takes me to do the same in C# and .NET. Combine PHP with Apache and MySQL and I haven't found anything I like better.

I don't think you can say the language sucks when so many of the best & biggest sites on the web run on it. You can say the programmer sucks though. I look back at PHP code I wrote 5 years ago and its a mess, but today I follow a lot of structure to my code and feel that its just as managable as anything I've written in C#.

I have a Halo 3 Multiplayer stats website, http://halocharts.com, that is written in PHP that's getting over 3000 unique people a day and tracking over 50,000 players. It would have taken me months longer to write the same site in C# and SQL Server, plus all of the licensing fees would have been a pain...

firestream on May 21, 2008 6:44 AM

I see PHP as a language that allows choice. I started with PHP out of necessity to get a job done. It was either PHP or ASP, and I was leaning toward ASP except I could find absolutely NO documentation on the net for ASP at the time, but more than enough for PHP.

PHP also let me choose my OS and my web server platform, which ASP did not. I'm a big proponent of choice.

You're right. I can code spaghetti code really quickly in PHP but I don't have to. The language let's me choose my programming style. I can (since PHP 5) go the object oriented route or complete procedural if I want. I can code sloppily or code extremely cleanly -- it depends on me. The function_list_that_goes_on_forever seems to be the same as the namespace.that.goes.on.forever, just a different convention.

It's choice. I'm grateful I have it to make. I choose to code responsibly and be wise in my coding convention, commenting and holding to an overall convention. If other people do not, then they've made that choice.

Danlb on May 21, 2008 6:49 AM

Think of the most popular and remarkable human cities; Paris, New York, London, and so on. Now think of their grunge; all the urban decay, trash dumps, and on and on. PHP is architected more like a human city than a piece of sculpture or painting. It may be that the crystaline precision of mathematics or formal art doesn't scale to human community sized endeavors, like New York or YouTube. PHP may be grungy, but so's most of the best stuff people actually use, as opposed to what people admire.

Pat Morrison on May 21, 2008 6:49 AM

I think most people forget the Human Factor. The #1 reason IMHO that php is so popular is because it brings the productivity to the human side. In Java and other older languages, you have to learn one of the bazillions of frameworks out there and hope that the framework does what you want. When you remove that factor, the speed that a developer can code (without errors of course) is linearly proportional to the speed he gets new features out. You want more features, just have to type faster! Haha!

Developers feel better if they think that the bottleneck of productivity is on their side, ie, one only needs to transcribe mental ideas to code to create new stuff, instead of having to learn some new API in an unfamiliar framework just to produce a Hello World. The problem is, not everyone is brilliant and almost everyone creates bad code. The difference between php and say java is that some of the components of an app (db acess, controllers, etc) are already solved out in a reasonably way for you if you use some framework.

IMHO frameworks like rails or grails managed to balance the needs of most common web app aplications into the framework itself, so that the developer effectively gets things done with minimum effort.

As for the maintainability myth, my view is that maintanability is much more design/architecture related than language related. Code aArchitectures normally don't scale in the sense that adding new functionality becomes more and more harder, instead of being a constant value.

My .2 €

Miguel Ping on May 21, 2008 6:50 AM

The great thing about PHP is its freedom. Professionals can use it in a growing industry, as well as "script kiddies" can use it in their mom's basement.

The structure and maintainability of the code is largely dependent and determined by the skill of the programmer. The way it should be...?

I am personally tired of hearing Microsoft fanboys denounce the PHP language for flaws that it had in version 4. Maybe you haven't checked in sometime, but version 5 is now out in production.

"If you sit down to program in PHP and have even an ounce of programming talent in your entire body, there's no possible way to draw any other conclusion. It's inescapable."

Wow, ignorance is bliss. I don't think you are qualified to come up with statements like this when you say you are a Visual Basic programmer. I have programmed in Visual Basic before, and I thought I was losing intelligence throughout the entire experience. A Visual Basic programmer, is a lazy, ill-informed programmer. That's just my two cents anyway.

I could be partially biased however, because I work with a VB programmer, and he doesn't know how to "write" code. He copies C, C++, and C# scripts from the internet, and runs them through a X to VB converter. Obviously that makes some pretty (sarcasm) code. ;)

Douglas on May 21, 2008 6:51 AM

So your argument is, essentially, that PHP is OK, because all the cool kids are using it?

Jacques Chester on May 21, 2008 6:52 AM

Why is a language bad? The worst crap I've seen many times was in the revered C++. Some of my best code in college was in Fortran, for crunching numbers. The Paradox Application Language (PAL) for DOS was completely logical and stylish.

Perhaps we judge a language based on the (pseudo) framework it's used in? I despise .NET Master pages and the mangling that occurs when the page is assembled and my viewstate is mis-placed. Case sensitive languages are retarded. Ruby is good but Merb is a better framework than Rails?

In the end it's what @monsur referred to as low "impedance mismatch", then it's the reliability, maintainability, etc., that the language offers.

steve on May 21, 2008 6:57 AM

I think the whole argument here makes a very big mistake! It mixes language and API. So do most articles you quoted or linked to.

This is a big mistake most people usually do with Java.

int i = 10;
String s = "Hello World";
Object o = new Object();
float[] farray = new float[20];

This is *language*.

ArrayList ar = new ArrayList(20);
Iterator it = ar.iterator();
JPanel jp = new JPanel();
jp.getContentPane().add(new JLabel("Hello World"));

This is not! This is *API*.

PHP as a language is very clean, has very little elements. It defines a couple of data types, primitive operation on them (add, sub, mul, div, and, or, xor, etc.), it declares functions, it declares objects, arrays and hashes.

The huge amount of functions, with inconsistent namings and unexpected behaviors because two similar functions might have entirely different behavior, these are all API. They are the default API, that means they are there on a fresh PHP installation without installing any plugins; but they are not really part of the language itself.

I admit, while it is very clear what is language and what not for other languages like Java or Perl (because this is documented), the borders are pretty blurred for PHP. However, PHP is not the only language where the borders are so blurred. Another familiar one, and probably mostly used language in computer technology today, is C. E.g. this is langua in C:

char * buffer = calloc(sizof(char), 100);

But C does not guarantee int's to be 32 Bit, so programmers like to go there and do

u_int32_t num = 10;

or

uint32_t num = 10;

and when you want to open a socket (for network data transfer), they do:

int so = socket(AF_INET, SOCK_STREAM, 0);

However, this is all not language. No C compiler in the world needs to successfully compile that. u_int32_t is actually nothing at all (where the heck does this come from? Only because it's there on most system doesn't mean it has a right to exist). The only thing the C standard specifies is int32_t, that is signed, not unsigned. uint32_t is defined in the POSIX Standard, but not every platform that supports C needs to support POSIX (many don't support POSIX). And the socket function is also only defined in POSIX. Linux is mainly POSIX compatible, so is MacOS X, but Windows for example is far away from being POSIX compliant.

Long post, short summary:
It's not PHP that sucks here, it's the default API of PHP that sucks, because of all the negative issues quoted or reported on other pages.

Mecki on May 21, 2008 7:03 AM

I agree with Jon's comment above, about PHP being a "WOP" (Web-Oriented Programming) language. People often ask rhetorically "But *why* is PHP so popular for Web programming?". Clearly, it's not because PHP is elegant from a formal language design point of view.

Just take a look, for example, at O'Reilly's "Learning" series of books. Compare "Learning Perl" and "Learning Python" with "Learning PHP5" (I'm doing it now using their Safari service). The first two barely address Web programming at all (at least not explicitly on the contents pages) and are clearly general purpose programming/scripting languages spiritually at home on Unix and derivatives. The PHP book, on the other hand, has a few chapters on language basics, and then gets right into processing forms, connecting to databases, managing user session, processing XML and uploaded files, etc. It has appendices that include information about configuring IIS and Apache, and the book doesn't assume its audience is is using or deploying to Linux or BSD.

This difference of emphasis is played out across the publishing industry and online resources, it's reflected in the nature of the advocacy for the respective languages, and consequently I don't find it surprising at all that PHP is used so frequently for web programming.

Roger Lancefield on May 21, 2008 7:08 AM

My main gripes as a PHP dev: no console and no first-class functions. I do like, though, that *the* data structure in PHP is an ordered dictionary. If the array functions were namespaced, "import array" would be as cool as "import antigravity"; you get a queue, a stack, a dictionary, and a list in one.

Braden on May 21, 2008 7:08 AM

Just because it's easy/possible to create spaghetti code doesn't mean you can't create efficient and maintainable php apps. My apps are object oriented, business logic is separated from the html, and I probably only use 5% of those 'a' functions.

sgb on May 21, 2008 7:08 AM

Funny, I've written a PHP Sucks article myself (and got lambasted for it) but I've put together one site in PHP and am starting another one and yes PHP still sucks, but you can get a lot of work done in it. I debated Java vs Ruby for my new site for weeks and finally decided, I'm tired of debating with myself, just get it done in PHP.

codist on May 21, 2008 7:09 AM

At my very first ever job as a Professional Software Developer(tm), I had to maintain a PHP app. I sometimes have nightmares about it.

Grandy Peace on May 21, 2008 7:10 AM

Why is pascal getting popular again?

Goran on May 21, 2008 7:14 AM

I'm not going to make dumb generalizations about everyone who writes code with PHP but it does seem that the way the language is designed really does encourage sloppy and procedural style code. I believe that better language design would help a lot with the quality and maintainablity of PHP projects that are available.

o.s. on May 21, 2008 7:14 AM

@steve:
Some languages are bad because they limit, restrict or force your choices. Take the example of namespaces. In a language without namespaces, I have to find a way to avoid name collisions. In a language without closures, you can't pass code encapsulated in a closure. That forces you to solve the problems using a solution you consider not to be the best. This is where some design patterns might help you out, they are a cristallization of a solution for a problem on a unique domain (example being multimethods and the visitor pattern).

OTOH, the more power you have the more rope you have to hang yourself into.

Miguel Ping on May 21, 2008 7:20 AM

Languages don't much matter. Programmers do. Garbage in, garbage out. A language doesn't magically transform your application into a work of art.

Bitter on May 21, 2008 7:21 AM

@Mecki

That defense is old in the tooth. Who cares if it's the "language" or the "API" - we all know what Jeff is talking about. Even the pro-PHP comments here admit that there's something less than ideal in the PHPsphere.

Besides, can't the problems in the library potentially be attributed to the language? I mean, if you want to draw lines in the sand and make the argument about language vs library, PHP is a good language, but is it a great language? I mean, no closures, no pure OOP (maybe you consider that a benefit, i don't), no mixins (i have seen hackish implementations), namespaces, late static binding (coming soon), horrible scope resolution (you need $this-> infront of everything..)

So even if you are right that we're all mixing library from language, it doesn't magically make all the problems of both the library and the language go away.

karl on May 21, 2008 7:22 AM

PHP Bringing order to the madness: http://www.qcodo.com/

Javierfish on May 21, 2008 7:25 AM

i think the great skill with languages like php (such as 'classic' asp) is to "program into the language" not just program in the language.

This is a Steve McConnell idea -- he harps on about it on every second page of Code Complete.

i've seen some very well structured, somewhat beautiful classic asp -- and it shows great discipline on the part of the developers.

lb

secretGeek on May 21, 2008 7:28 AM

Since I was quoted in this post, I figured that I would make a contribution to the steady stream of comments.

In my opinion PHP sucks because:
a) Incredibly inconsistent naming
... 1) Mixing of underscored and non-underscored
... 2) Inconsistent abbreviations, e.g: using "i" or "case" to imply case-insensitivity

b) Somewhat inconsistent argument order
... array_map(func, arr) vs. array_walk(arr, func)

c) Expression de-referencing
... Meaning doing something like: "echo (array(1,2))[0];" will fail miserably. Except that it works for object references... IN SOME CASES, could it get any more inconsistent ?

d) No (proper) support for lambdas or closures

e) No support for namespaces, yes it's coming in 5.3/6 but it should've been there from the beginning - in maybe 3-4 years we will be able to use namespaces in production code.

f) Usage of array() instead of a simpler syntax such as [] or {} for creating arrays, which makes it incredibly ugly and hard to read when you need to nest several arrays

g) Usage of -> instead of . as the object operator, this is actually more a convenience concern then aesthetic, writing -> (at least on Swedish keyboard is a PITA)

h) Incredibly old fashioned object model, it got a worse feature set then Java had back in -96. They've tried to launch PHP as an "OO"-scripting language, right.

i) A lot of functions that mostly do the same thing, takes the TIMTOWTDI to a whole new level.

There are a couple of more issues for me personally, but these are the nine main ones. And all the issues with the "hobby" community, etc.

So yeah, PHP sucks. However I still use it because it puts food on my table and pays my bills.

Fredrik Holmstrm on May 21, 2008 7:31 AM

This same argument was once used for COBOL. PHP will eventually be replaced as COBOL was. Sad thing is, it will take very long. Even today COBOL struggles on some reincarnations.

jm on May 21, 2008 7:36 AM

Isn't the classic "but you write PHP that doesn't suck" example Drupal? It usually comes up in these kinds of discussion anyway.

hpr122i on May 21, 2008 7:36 AM

It's patently clear very few people posting comments here (or Jeff) has used PHP any time recently. There's no other explanation for the foolish and incorrect things stated here.

I used PHP in 2001. It was slapdash. Using it as a comparison is called a "straw man." Boo.

I use PHP in 2008. It's got everything you need to build stable, well-designed, scalable apps. Period.

The *only* legitimate complaint I have ever seen about the language itself is lack of namespacing. Welcome to PHP6.

There's nothing wrong with the language.

People who use it poorly have themselves to blame.

Kyle Hale on May 21, 2008 7:36 AM

As someone who codes VB6 and PHP pretty much exclusively (though I have gone on to VB.NET, 'cuz it was free and all), I just want to say that my goals are never to be elegant. My goals are to be quick. I am an experimenter, a tinkerer. I am not a computer scientist by training. I am a historian who can code a bit.

Having languages like VB and PHP allows someone like me -- who doesn't want to do memory management or worry about callbacks and etc. -- to quickly throw together things that other people won't. Can I beat the computer scientists when it comes to writing efficient code? No way. Can I beat them when it comes to writing code I can use? That's the whole point.

So what's my point, in the end? The people who bash PHP aren't taking into account the crucial social aspect of it. Why does it matter that Wikipedia and Wordpress are written in PHP? Because practically anybody can work on them. In a land where processor time is cheap, the ability to quickly modify an existing program is king.

I write my own database interfaces in PHP because the off-the-shelf programs for historians, like EndNote, suck a big one, in my opinion. They aren't set up for me and they can't be customized to my needs easily -- something that's a big problem in the humanities, because my work doesn't fit into nice little boxes each time. Each project has its own needs and considerations. A well-structured program is, well, a little too well-structured. Something made out of PHP can be mashed about, changed, new things added quickly, etc., on the fly. And it works.

Should an entire OS be made out of languages like this? Should critical programs be made out of languages like this? No way. Should programs that place a high, high priority on being easy to edit by people without CS degrees be made out of languages like this? Yes. And _of course_ that's going to bug people with CS degrees -- PHP makes those of us without them think we can nudge you out of the picture. ;-)

Shmork on May 21, 2008 7:36 AM

PHP is successful for exactly the same reason VB was successful: they both made a simple thing very simple while no-one else cared.

Unfortunately both sucked in every other possible aspect, thus repelling most good programmers and attracting hordes of bad/amateur programmers, building a huge environment of crappy coding standards.

And unfortunately PHP still has a big selling point: want to do a web app that you can install everywhere? Do it in PHP.
And so we are stuck with PHP for a long time.

Also, it is true that a bad programmer can write bad programs in every language, but the reverse is not true.
- If you don't have namespaces you are stuck with adding 'whatever_' in front of all your functions,
- if the language doesn't have a consistent naming convention you can pick one, but you will still live in the mess
- if (for example) you don't have function pointers or first class functions you are stuck with doing the big 'switch' statements
...

E[X] on May 21, 2008 7:38 AM

Having used PHP 4 for some years on my own site, and PHP 5 to make a website for a small company, I'd say there are lots of reasons why PHP is a good idea:
- The "User contributed notes" are actually useful and usable.
- There's no "architecture astronaut" tendencies - The simple option is usually the default, while more advanced functionality is available with more parameters or other functions.
- The web pages are better than for .NET - Faster, much tighter hierarchy, no JS bugs to break the whole site in Firefox.
- It's platform independent, open source and Just Works.

In short, it's built by developers (so it's messy) and for developers (so it actually works).

Victor on May 21, 2008 7:40 AM

"SQL wrapped in spaghetti PHP wrapped in spaghetti HTML", you got it in one. The whole thing is a mess...

kcg on May 21, 2008 7:41 AM

Everthing suck, Windows, Linux, UNIX, BSD, Mac OS all suck. Operating systems suck. Languages suck. With that in mind you are left to question yourself, what does suck less for my purpose?

Hoffmann on May 21, 2008 7:46 AM

so I should learn PHP now ? :)

For me the syntax is just as important as the framework and for me the php syntax was never somthing I felt comftable with. But again alot has happened.

Peter Palludan on May 21, 2008 7:50 AM

"As someone who codes VB6 and PHP pretty much exclusively (though I have gone on to VB.NET, 'cuz it was free and all), I just want to say that my goals are never to be elegant. My goals are to be quick."

Someday you'll have to maintain some code written by someone with the same goal.

Charles on May 21, 2008 7:53 AM

Another one for the list... Flickr is also developed using PHP.

As other commenters have mentioned, PHP is vastly available - almost all shared web-hosting supports it! Which is why a lot of open-source apps are developed in PHP, (quick-n-easy deployment).

I think a root cause of poor PHP coding practices comes from the lack of an established IDE. (I know of Eclipse, but never used it). Could you imagine developing C# without Visual Studio?! (No thanks, I want my IntelliSense!)

A good IDE goes a long way towards guiding coding practices for would-be spaghetti developers.

Lee Kelleher on May 21, 2008 7:57 AM

I love these discussions.

First off, I'll agree with the Jeff here. I'm not going to stand here and say that PHP doesn't have it's drawbacks and it's flaws. But it is successful for one MAJOR reason, it WORKS and works easily.

Hey, I can be a very disgusting coder if I really want to be. No matter the language I can spew out some very nasty code. So I'm really fed up of people blaming the language for their crappy code.

Because PHP is so light weight, it makes it easy to get stuff out the door with less of the safety measures that would be required in other languages because the thing compiles. That's why you have people sticking an entire application in one index.php file that works off of URL parameters.

Also, people need to realize that ASP.NET is a FRAMEWORK and not solely a language people. PHP is only a language. Frameworks such as CakePHP are now evening out the playing field a bit.

Now, I can't help but comment on this dude (cdbaby.com?) that scrapped 2 years of Rails to "code it properly" in PHP. I don't even know where to comment on that. Anything can be coded in any language, but it escapes me how a Framework like Rails didn't seem to satisfy his needs.

3 years ago if you'd ask me what I'd use to start a web application, I would have said ASP.NET. Because that's all I knew that had a high enough level to take me away from all the grit work. But that's because I didn't know about things like Rails and CakePHP. Right now, CakePHP is at the top of my list. It gives me the high level I want in a framework (really, at this stage I don't need to be messing around with pretty URLS and crap like that. Also, unless it's real complex and need to be hand written to be efficient, I'd rather stay away from SQL. Not because I'm scared of it, but because 'select blah, blah from blah' get's old after the 5th time) and the get up and go that PHP allows.

I'm sorry, I agree 100%, PHP may suck, but who cares? It works! It's much like what I've said before:
<a href="http://www.webdevelopment2.com/choice-web-development-framework-matter/">http://www.webdevelopment2.com/choice-web-development-framework-matter/</a>

Baz L on May 21, 2008 7:59 AM

Jeff, have you read how the TIOBE index is compiled?

From their site:
"The ratings are calculated by counting hits of the most popular search engines"

That is NOT the same as counting the number of sites built in a language. Nor is it an indication of the number of developers working in a particular language. After all, Java coders might need to do more google queries than C# coders...

Never mind the fact that PL/SQL, MySQL (not rated), and Transact-SQL queries make up less than 0.71% of the total. Using your logic, the implication is that less than 1 out of 100 programmers use a database backend...

Further, going from "Some of the largest sites..." to "...powering so much of the internet" takes a bit of mental gymnastics.

Chris Lively on May 21, 2008 8:06 AM

After years of avoiding php, because of all the ugly examples I had seen, it quickly became my favorite web language. Apart from the dollar signs, it works well with how I think. All my php code is short, clear, and fast. Almost all the things I had to write from scratch before are built into the language.

http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

David on May 21, 2008 8:07 AM

As one who has been working with PHP since the mid-90s, I can say with absolute certainty that my comfort level with the huge array of built-in functionality, as well as my memory of needle/haystack mixups throughout are both quite high. I can work quickly and elegantly.

The ego I am reading here in the comments is not surprising to me. An awful lot of people complaining about PHP circa 2001, and not looking at all to the future of this dynamic, useful, broad-reaching language.

But if you want to keep bashing it because it's not branded with a giant corporate logo, or doesn't come with its own IDE, or has no built in make_website_work() functions, fine.

Stephen on May 21, 2008 8:09 AM

I agree completely.

Programming skill is the important thing in php. You can build ur program completely scalably with code reuse etc, or you can build a nice bowl of spaghetti. I've written some php and using simple OO patterns you can have very elegant looking code ... or not.

mordy on May 21, 2008 8:12 AM

"SQL wrapped in spaghetti PHP wrapped in spaghetti HTML" - That means that you suck, not the language. And does this also mean that HTML and SQL arent any good?

This is obviously just an emotionally charged rant. Its also missing information - You seem to have no idea that there are MVC frameworks for PHP. And speaking of that, your article a while back on MVC sucked too. Oh well

PHP is everywhere
PHP is free
PHP is fast
PHP is feature rich
PHP is well supported
PHP has an excellent user base
PHP has many community developed tools
PHP is well documented with an excellent online manual
PHP isnt Microsoft ( because monopolies are bad & competition is good )

And no, my friend, PHP doesnt suck, but unfortunately many of its users do, as with anything thats popular.

Ben on May 21, 2008 8:18 AM

You may be missing the problem-space php is meant to address. That list of keywords isn't long, by any comparison. The function list is long, unless you think of the underscore as a namespace scope character, then it just feels like a normal library. Do you want to compare the list of php functions to the list of .NET methods? php is common because it doesn't generally screw around with overengineered object models, instead it tends to use handles. It's small and fast. It scales.

Because of this C sensibility that eschews much of the overwrought object casting, reflection, narrow-casting, boxing and unboxing, factory patterns, &c., it fits on thin middle (presentation) tiers.

I have to say, after the whiny, amateurish article about XML and the whiny, amateurish article on php, this site no longer holds any value for me. I haven't seen any aggressive stances on real problems for months. I'm outta here.

Brianary on May 21, 2008 8:21 AM

Python philosophy is about having a concise powerfull language, philosophy which has proven to be a good choice (As explained in code complete).

I still prefer PHP though it is a mess (non consistent function naming, useless once in a lifetime function proned to be unsufficiently eyeballed/tested).

Why do I prefer php ? Easy to use and powerful, with a low and high level control. 'Rail' like framework (Cake/symfony) are even being ported on PHP. So what is the problem with PHP ?

As a sysadmin however I am really scared of PHP because its community is flaming hardened PHP project though security is a major issue in php not only because of the language in itself but also because of bad habits among developpers PHP.

(interview of stephen esser on php security that is quite uneasing)
http://www.securityfocus.com/columnists/432/2

And as for any open source project, I do think the project has the value of its community, and its community in my opinions are a bunch of careless freaks that just stack up functionnalities without regards for the core of the language, especially security.
I know the claim of php6 on security, but the simple presence of the mail() function is unbelievable. Using this function is like asking to be spanked naked on the web.

I am still an happy php user but not very confident in its future.

jul on May 21, 2008 8:21 AM

I will agree that certain aspects of PHP suck, for instance having to use functions on arrays instead of seeing them as objects and using the array->function way of doing it.

But PHP fulfills it's purpose brilliantly. It's designed for the web, and I haven't found another web-based programming language that makes it as easy as PHP does. What requires one line in PHP can take at 6 to 10 lines and objects in say, Python (I know Python is used for things other than the web, but still).

For what it is designed for it works great.
Some complain about the $ and -> notation, but this just gives personality to the language.
Others have complained that there are so many different configuration possiblities, like magic quotes or register_globals, but any experienced PHP programmer knows how to either disable these, or completely code around them.

And Jeff, you've complained about the sheer number of functions in PHP. Now I'll agree that they could use namespacing, but that doesn't matter really. PHP's manual is the best and most comprehensive manual for any programming language I've ever seen, and you can quickly find a function and its parameters based on what you want. You cannot honestly tell me you jsut look at one giant alphabetic list of functions to try and find the one you want. If you are, then you are effectively nullifying your argument, as the developers have given you a great resource and you are just ignoring it.

And on the subject of script kiddies, I'll concede that there are far too many out there, and the code they write is atrocious. But the beauty of PHP is that it is simple enough for that to happen, but still incredibly powerful and powerful enough for experienced programmers to write clean, ordered and well-written code that goes like the clappers.

I think you're just nitpicking really, and PHP is a great tool to anyone who knows how to use it properly, despite some of it's flaws.

Matt Wilkinson on May 21, 2008 8:22 AM

Seriously, what's up with the stats on the TIOBE page?

According to the "Delta in position" column, PASCAL, COBOL and LUA (whatever the heck that is) are GROWING STRONGLY.

Meanwhile, C++ and JavaScript seem to be dropping in popularity.

How can that possibly make sense?

Rofa on May 21, 2008 8:23 AM

PHP itself isn't that bad really, the problem is that it easly allows people to write big ball of mud applications. However, you are always free to write good structured and clear applications. So the problem comes probably not from the language itself, but from the people, who use it.
That's probably why everybody always says PHP doesn't have OO. Yeah, it does! Just because people don't use, doesn't mean it's not there. I think it's very well possible to write good PHP application, just as long as they don't get too big, because web-scaling is a whole other issue.

Funny thing is, when someone ask around office, if there a PHP function to do task X, the answer is usally:

"PHP has a function for EVERYTHING!"

And it's true! Wether or not that's good, i don't now.

greg on May 21, 2008 8:28 AM

I've written about 200k lines of php in the last year. I've also written a huge amount of VB.NET and C# too. I find that the largest difference is that php will let you do what you want to, ugly or clean, whereas the others tend to guide you toward cleaner code. You can be clean with php, you're just not going to learn it from online tutorial sites. OO only really came with PHP5, so most of the stuff out there - even though 5 has been out awhile now - hasn't really been moved over. The frameworks are nice, and can really help, but often times it feels like you're just bring out a bigger sledge hammer.

Chris on May 21, 2008 8:35 AM

-------------------------------------------------------------------
Seriously, what's up with the stats on the TIOBE page?

According to the "Delta in position" column, PASCAL, COBOL and LUA (whatever the heck that is) are GROWING STRONGLY.

Meanwhile, C++ and JavaScript seem to be dropping in popularity.

How can that possibly make sense?
Rofa on May 21, 2008 08:23 AM
-------------------------------------------------------------------

I've heard COBOL is still used by the majority of banking systems and LUA is an upcoming scripting language used a lot in Games today (for example World of Warcraft and Civilisation 4).

greg on May 21, 2008 8:36 AM

"And does this also mean that HTML and SQL arent any good?"

Actually... it does! SQL is a curse for computer science, huge legacy of bad choices both from the semantic and the syntactic point of view. It would take me too many words to explain why SQL is a bad programming language.

HTML took forever to decide if it was a language to describe the structure of a document or its aspect, it's full of legacy tags that nobody uses nor knows what they were for. Add CSS and JS to the mix and you get something that nobody fully implements, nor understands.

E[X] on May 21, 2008 8:37 AM

Smells like a troll.

"If you sit down to program in PHP and have even an ounce of programming talent in your entire body, there's no possible way to draw any other conclusion. It's inescapable."

So the guys that coded all the popular websites you mentionned don't have an ounce of programming talent ?

You can make bad code with anything.

manu on May 21, 2008 8:40 AM

It lets people actually get the job done and for those who pay the bills that's what matters. While I like the concept of logical syntax and clean code, working code is what most other people expect. PHP seems to produce results for a lot of people.

Larry on May 21, 2008 8:40 AM

"What personally makes me laugh in my mind is how everyone always says how PHP is so badly designed etc., but never can actually show how it slows down their app development."

Huh? What? Did you not notice the lengthy blog post above the comments section? You might go and read some of the links. Choosing PHP over something else is a choice between money and time. What do you want to spend more of? You must pick one.

Yes, trivial PHP apps can be set up faster than trivial apps in other languages, but trivial apps don't really mean squat in the real world. I would rather spend two weeks setting up a good environment like ASP.Net, than spend any time debugging a complex PHP application.

Good developers have a 'spider sense' for bad code - I can tell bad code from 20 feet away, without even seeing the actual characters. I can sometimes tell bad code without seeing it at all, just by how the app behaves. PHP code is almost always bad code - meaning it's unstructured, unsafe, incoherent, littered with dependencies, and hard to read. Sure, it's possible to write good code with PHP, but the properties of the language itself and its community more often result in code that reminds me of "made-up-of-different-stuff-guy" from the Pepsi commercials.

Jasmine on May 21, 2008 8:43 AM

@karl:
Well, it matters in that aspect, that I can take the freely available source code of PHP, strip away all of it's default API and ship exactly the same language (same syntax, same abilities) with a completely different default library of my own.

Maybe there even exist alternative libraries for PHP already. Perl has plenty of them. Perl has many build-in functions, but also many that are not. If you want to get webpages (HTTP requests) or send e-mails, you don't use anything from the stardard Perl lib, but you install a custom plugin from CPAN. And here for one and the same task, three different plugins could exist. And if one sucks, why not taking the other one?

I just remember this way too well in Java forums. First people came there and said *Java* sucks, because with AWT you can't create usable user interfaces. AWT is just part of the default lib, it is not Java. Then Sun released Swing, which could everything AWT was lacking - and people said Java sucks, because Swing does not look truly native and it's way slower than AWT. However, IBM has SWT, which is as fast as AWT, needs much less resoures than Swing, still can do almost everything that Swing can do and it looks as native as possible on every platform supported. So, when you use this, does Java then still suck? No... but wait, it's still the same language, isn't it? So it actually never sucked. It was the AWT and then Swing API that annoyed people, not the language per se.

Of course you do have some valid points about the language itself in your post.

> no closures,

Like many other languages - I don't see this critical.

> no pure OOP

Since when needs a language to be pure OOP to be good? Many are not even OOP at all and many are OOP, but don't force OOP down your throat. I see no problem with that.

> no mixins

See above, I see no problem in that. Since when must languages have that? Actually the wast majority of languages don't have that. And I don't think it is good either. It leads to very dirty code and confusion.

> namespaces

Yes, that is indeed bad. Namespaces are important. But C has no namespaces either, not even Objective-C on Mac has it (and it's full OO Support to C in a much cleaner way than C++ does). And in many languages that actually have it, people don't use it anyway.

> horrible scope resolution (you need $this-> infront of everything..)

Just like you need "self" in front for Objective-C code. Okay, you wouldn't need it to access instance variables of the current object, but I think you can use it there as well and it has the advantage that you see it is an instance variable (not one in the current method scope) and also makes sure the instance variable is used, even if there is a variable of the same name in the current scope.

So these are all no killer arguments to call PHP a bad language. All valid, but not killer.

Mecki on May 21, 2008 8:49 AM

Your main points for calling PHP a bad language choice is its function list and sample code written by others... I am a PHP programmer for my job and by choice on my freelance web projects. I also write in C# but for windows applications only because lets face it ASP and ASP.NET are the slowest choices for web langauges on the net. PHP is fast and easy, like lots of individuals have stated before myself. It is lightweight and with the use of Zend Studio easy to debug.

One might not call the developers on the PHP project of genius stature but one thing you can give them is the rapid pace at bug fixes. I do agree their function naming conventions could use some work, but one can always write useful wrapper classes that use those functions and have your naming conventions.

As you have said before in a previous blog "your code sucks", and the same is true for PHP code and coders. Most coders do not use good naming conventions and best practices so their code is hard to read and modify. The last time I looked PHP was the most widely used langauge on the web, so you are going to run into more bad code than the others for web projects.

At the end of the day one needs to use the technologies they know and are comfortable working with. So to me instead of throwing it out with not ever really using it, or developing with it on your own I challenge you to do so. That is how I found that I do not like coding in Ruby or even the .net framework for the web not by analyzing from the outside looking in and just saying they are bad languages for the web.

Matt on May 21, 2008 8:58 AM

> "And does this also mean that HTML and SQL arent any good?"
>
> Actually... it does! SQL is a curse for computer science, huge
> legacy of bad choices both from the semantic and the syntactic
> point of view. It would take me too many words to explain why SQL
> is a bad programming language.

The point of that was to show how the logic is flawed, not that SQL or HTML actually suck. Anyway, SQL is not a programming language. Its designed for getting data out of tables.

> "...Add CSS and JS to the mix and you get something that
> nobody fully implements, nor understands."

I think the guy above said it best... everything suck - And at all times. This the human problem we're facing here, a language problem, which is sliding down the heap from VB to PHP, and now to English

This article should be deleted

Ben on May 21, 2008 8:58 AM

youtube *is 100% python*:

http://highscalability.com/youtube-architecture

poko on May 21, 2008 8:58 AM

Wow,

Fun little article with alot of titty tatty comments underneath...

So let me indulge:

1. To all the ASP is better because there are more professionals involved people:

Just stop right there. I can show BILLIONS of examples where I work and other places of applications written in .Net something and the code is simply unmaintainable. Don't even get me started on compiled DLL's and binary signatured project files... Remember MS is the company that made Ctrl-Alt-Del famous because their OS locked up too much.

If PHP is bad because of all the "ScriptKids" then ASP is bad because of all the "I just read ASP for Dummies and I love drag and drop" n00bs!

2. For all the PHP nay sayers because its hard to keep PHP clean:

Just stop right there again. Most php books/references will tell you to use notepad simply because they expect you to be a stupid moron who doesn't know how to torrent Dreamweaver or install Notepad++. Use a real editor, put down the PHP for dummies book, goto to university, learn how to program, learn what it means to "include" something, learn OO programming, rewrite your application, then gives us your 2 cents... maybe we'll listen.

3. FFS use SVN when doing a project, its not hard to setup and will help you 53,757 times.

4. There are just too many "Oh I read dummies books, please let me be a web developer" people out there. Learn how to program from a college first before you go spewing forth ASP spaghetti on the rest of us.

5. Web Development is not PowerPoint, stop trying pretend like it is.

Rob on May 21, 2008 9:01 AM

I love it when people use the infamous array function list as an example of PHP suckage. Sure that's a huge list, but PHP has better array support than any other language I've ever used. You're just jealous.

The list can get a bit confusing at times, but that's why PHP has the best online documentation in existence. Don't know what a function does or need a refresher? http://php.net/functionname.

The few posts above which dared to argue that PHP doesn't scale are horribly mistaken. First, the front end tier is rarely the source of scaling issues. Second, opcode caching systems such as APC and Zend Platform work remarkably well. Finally, Apache is a huge memory hog and that is often mistaken for a problem with PHP itself. Luckily, PHP runs on lighttpd and many other lightweight web servers.

Last but not least, arguing that "low barrier to entry" is a bad thing sure sounds elitist. You can get a closer shave with a straight edge razor, but do people still use them? No, because in the age of throwaway safety razors they're impractical.

Gil on May 21, 2008 9:04 AM

"Some function names consist of more than one word. There are three conventions for combining these words:

1. Glued together: getnumberoffiles
2. Separated with underscores: get_number_of_files
3. Camel case: getNumberOfFiles

Most Languages choose one of these variants. PHP uses *all* of them."

Actually, 1 & 3 are the same thing as PHP isn't case sensitive when it comes to function names, it is in other aspects tho, making it suck even more.

krs on May 21, 2008 9:07 AM

-----
I've heard COBOL is still used by the majority of banking systems and LUA is an upcoming scripting language used a lot in Games today (for example World of Warcraft and Civilisation 4).
-----

Yes COBOL is still used far too much ...

Lua is a scripting language that is designed to be embedded in other systems, e.g. Games but it is also used as a Web Scripting language, and even a webserver! ... the core is a very simple language (with all the things people say are missing from PHP) that is designed to be extended by libraries and the host system

Jaster on May 21, 2008 9:08 AM

Dear Jeff,

I have been an ardent reader of your blog. I have always enjoyed reading you arguing against the common notions of programming, I did believe you are truly a pragmatic programmer as you believed in getting the job done and not care too much about some of the academically approved approaches to solve a problem, something that purists rant much about. But I must say I am extremely disappointed with your disapproval of PHP as a programming language. If you are a truly rational thinker, why cant you justify using a language thats so much more productive in the web environment than any other options we have.
I am quoting from a presentation by rasmus, this is how you parse an Atom data in php

$url = 'http://www.flickr.com/services/feeds/photos_public.gne';
foreach(simplexml_load_file($url)->entry as $it) echo $it->content;


Now why would anyone not use it if it has this kind of power ? Since when you have become a language purist, who hates to see functions named rather inconsistently ? After all you are the one who has said that <a href="http://www.codinghorror.com/blog/archives/001062.html"> code is not beautiful </a>, remember ? , you are the one who said (commenting on joel spolsky inventing a new language for his product) that <a href="http://www.codinghorror.com/blog/archives/001022.html">the language does not matter </a>.
I thought all you cared about is user experience, and for a language that is designed to work optimally in web environment, if its going to make you super-productive, how is it not good for the end-users ?

Why do you care about how the code looks like ? why do you blame the language for the bad code that not so careful programmers produce ?

I do believe, the reason you are seeing bad php code all over, is due to the fact that php is such an easy language to learn that anyone who might not have any programming experience can jump in and write some code over a weekend.
Are you looking for a language that PREVENTS bad programmers to output bad code ? do you really believe any such language exists ? don't you think that design/architecture of you application is more significant than the syntax of the language you used to code ?
Come on.. give me a rational (and honest) answer, will you ?

amit on May 21, 2008 9:12 AM

The problem with PHP is that almost everyone and anyone can write functions for PHP. For example, there are FIVE functions you can use to replace a substring in a string:

* str_replace
* str_ireplace
* ereg_replace
* eregi_replace
* preg_replace

Notice str_replace and str_ireplace vs. ereg_replace vs. ereg_ireplace.

I hate PHP and it drives me crazy because I can never remember exactly how to do everything.

PHP's saving grace is its ability to be incorporated into HTML. That means you can quickly create a web-based application. Plus, since it is executed on the server site, you don't have to worry, like you do in JavaScript, whether the user's browser will be able to execute your code.

I may hate PHP, but it's what I use when I do my work.

David W. on May 21, 2008 9:12 AM

What I find interesting is how infrequently people talk about the maintainability of PHP. I absolutely agree it's a great language to slap out version 1.0 of your site, as long as you have a really small team and not to complex website.

But once you grow, adding features and developers, the big productivity gains you had quickly disappear. After about a dozen people are working on a PHP app it generally starts to falter in terms of maintainability. Never mind 2-3 versions of features.

Initial productivity is great and speed to market is great. But it's not everything. When I start a business I expect to last at least several years, so I prepare for that. Sure initially I might have to absorb a little bit more cost, but in the long run it will pay off in spades. If you think speed to market is the end all be all, you might want to watch DHH's video at: http://www.justin.tv/hackertv/97862/DHH_Talk__Startup_School_2008

One last note, the fact that the language hampers the ability to create functions due to namespacing issues, this tells a lot. Especially as the source and team grows, it really hampers keeping the code clean...

Stephane Grenier on May 21, 2008 9:15 AM

Jeff,

honestly, PHP/VB doesn'tmatterism aside, are you driving mindless traffic to your site with these somewhat outrageous posts (screen touching, then error page with clouds and now PHP)? This site is turning (slowly) to Oprah Magazine of coding-related blogs.

Yes, language design is hard. So is programming. But that does not imply that beautifully designed languages are good for the job. VB is an example of a language that should have never left Redmond labs. I wonder how many developers out there have suffered direct and indirect indignation because of the "cloud of doom" called VB, the rapid dev. environment which broke all rules of OOP, OOD and language design and shed serious doubt to many a developer's ability to think in OO terms (whether that doubt was justified or not is another matter).

Bottom line: if you don't like the language (and I also do not fancy PHP), just friggin move on. Power up a C++ compiler, do whatever you have to do. Program in assembler for a while, you will learn to appreciate programming as an art much more after that.

Best,

BugFree

BugFree on May 21, 2008 9:17 AM

On the subject: <a href="http://www.mysqlperformanceblog.com/2008/05/20/apache-php-mysql-and-runaway-scripts/">http://www.mysqlperformanceblog.com/2008/05/20/apache-php-mysql-and-runaway-scripts/</a>

(Summation; certain runaway PHP scripts will NEVER be killed, and there is no obvious graceful way to avoid this. FastCGI would work, I suppose, but neither PHP nor Apache are actually very FastCGI friendly)

Robert Synnott on May 21, 2008 9:18 AM

People use PHP for the same reason they use Linux; because they are masochists. Why do something simple like run a tiny install program when you can recompile the OS?

Mitur Binesderty on May 21, 2008 9:20 AM

"Anyway, SQL is not a programming language. Its designed for getting data out of tables."

That depends on how you define 'programming language'.

"I think the guy above said it best... everything suck - And at all times."

Not true, there are things that most definetly suck less than PHP in many aspects.


@ Mecki:


>> no closures,
>
> Like many other languages
>
>> no pure OOP
>
> Since when needs a language to be pure OOP to be good?
>
>> no mixins
>
> See above, I see no problem in that.

So PHP can't do good OOP, can't do good Functional Programing and (obviously) can't do good Logic Programming. Wonderful.

>
>> namespaces
>
> Yes, that is indeed bad. Namespaces are important. But C has no namespaces either,

So, we should uniform to a language designed 40 years ago? At least C can be excused because it runs fast.

> And in many languages that actually have it, people don't use it anyway.

That's not true. If you have them then most libraries use it, user code maybe doesn't, but you can write bad code even with good languages.

This blog is giving me strange error pages.

E[X] on May 21, 2008 9:21 AM

The list of function beginning with an 'A' does not convince me that PHP sucks. Most functions are equivalents of C library functions and the syntax itself is similar to C.

What suck(ed) about PHP were attempts to ease things for programmers:
o using values from GET and POST an
o quoting variables to avoid trouble when building SQL statements by
adding strings
But luckely this nonsense can be switched off and with the addition of the PDO library in PHP5, SQL handling has become sane.

But the reason why most sites use PHP is that the most webspace providers offer PHP. (Yeah you can upload Linux binaries to sites like Godaddy but because they don't support .cgi files, you have to wrap 'em with PHP.)

Mark-Andr Hopf on May 21, 2008 9:21 AM

I used to really enjoy visiting your site for some interesting articles but since you picked up on the idea of just being dramatic to draw more visitors (like the wordpress article and then this one) I am starting to question your general attitude.

First of all, the list of functions you posted above is not the native list - you included a whole bunch of items from external modules like the APC and APD ones. Remove those and the list is half the size.

Secondly, PHP evolved over nearly a decade and had to increase functionality while maintaining backwards compatibility. It's easy to look at something with a decade of hindsight and say "oh this could have been simplier/cleaner" (same thing goes for WordPress btw)

PHP is about getting things done and allows even novice programmers to be incredibly productive in a very short amount of time. If someone knows just a little javascript, they can easily code in PHP very quickly.

Leave coding elitism in the labs. I've got bills to pay and things to get done. PHP has been wonderful.

ck on May 21, 2008 9:33 AM

I like PHP because it is very similar to C, which is the greatest language in the whole universe. Now, you are saying that PHP is not good because its language design sucks and you are entitled to your opinion, without ever using C, PHP or UNIX. Still, you are entitled to your opinion. However, i consider you as an inexperienced douche bag that loves BASIC, .NET, everything that has the brand of M$ on it and nothing else.

PHP suports O.O. but not a lot of people choose to use it. I guess after all O.O. is not the "Holy Grial" of programming. You forgot to mention that PHP is an extensible language and you can use multiple frameworks or maybe you just didn't know that.

Anyhow, isn't it good talking shit about things you don't know about?

keitaro on May 21, 2008 9:33 AM

This kinda harkens me back to a previous post of yours (Nobody cares what your code looks like), it doesn't matter whether the code is ugly or if it's damned beast, all that matters is that it does the work it's supposed to.

This is supposing PHP is a bad language to begin with, but to my rather minimal knowledge, when you say a language is bad, it means that it doesn't do what you need it to (obviously not the case here), true, you may have quite a few nights of hair pulling over messy code, but we see those in all languages..

Viredae on May 21, 2008 9:36 AM

The first language I learned, aside from HTML was PHP, and as I progressed it became very clear to me that in order to learn a lot of other languages I would need to ditch what PHP had instilled within me.

I agree that PHP sucks, but it works, and it's available almost everywhere. If you want to make a website with a back-end the default is PHP.

I'm starting to warm to Haskell now. Perhaps with all the recent developments it'll pass over to the web?

Mike on May 21, 2008 9:37 AM

PHP_does_not_suck();

PHP has a wider vocabulary.

Marcel on May 21, 2008 9:39 AM

Your analogies are prety weak this time around. You basically say, well there is a plethora of spaghetti code out there for a language THEREFORE it sucks. The fact that PHP is easy to get into should not count against it. That has probably been one of the facts that brings it to the front in terms of adoption. It takes the finesse of a GOOD programmer to write GOOD PHP code like with ANY OTHER language. A crap programmer will write crap code, end of story.

Andrew Revak on May 21, 2008 9:42 AM

As a contractor, I've lead the development of various large enterprise level applications in both PHP and ASP.NET.

It's my opinion that ASP.NET is better simply because it's well organized and there's better community support, but that's just my experience. You have to be an amazingly disciplined programmer to build a large, well-written PHP application, and most people just don't have what it takes. I've also ran into more problems building apps around PHP than ASP.NET. For example, once our team built our data access around PDO only to find that some of the features we needed to call stored procedures were not yet completed! How do you explain that one to a client? Oh yeah.. it's open source.

Of course, the last time I used PHP was before the Zend Framework came out, so it might be getting better. The fact is, PHP has to get better or die. Search any job board for ASP.NET jobs versus PHP jobs and it will explain itself.

Justin on May 21, 2008 9:46 AM

We are problem solvers.

PHP is a means to solve a problem. .NET is another means to solve a problem. Python is another means. All languages are all means to the same end - solving the problem.

While PHP certainly has its flaws (just like every other language), it's unfair to attack the language itself without at least presenting the context in which it sucks.

Using PHP to build an enterprise-level desktop software would probably suck. Using PHP in an environment involving many programmers each with their own preferred style and syntax would probably suck. If these are your problems, then perhaps PHP isn't the best language.

But if your problem is creating a web site that serves dynamic content quickly, cheaply, scales well, and adheres to any modern programming standards you wish to program into, PHP is an excellent choice.

Aston on May 21, 2008 9:46 AM

People need to compare PHP to Ruby, not to RoR.

RoR is just a framework. We need to get ruby either bundled _with_ RoR, or (much better) strengthen ruby's inbuilt stuff to tackle php.

PHP made it easy to create something, but with ruby this is a lot simpler. We need to find the few key areas where PHP shines.

It is NOT availability of web servers! In the beginning hardly anyone offered PHP on their host.

It is about producing _results_ that are USEFUL.

markus on May 21, 2008 9:48 AM

Ok, PHP sucks. So does a vacuum cleaner, but when you want to get dirt off the floor it comes in pretty handy.

So, why did/do all these monumental successes that you reference use PHP? Is it because all the founders are stupid? Or just non-technical enough not to know the difference? What's so great about PHP, or is it just a big coincidence that all those sites use it? Inquiring minds want to know...

BillAtHRST on May 21, 2008 9:49 AM

"I'm starting to warm to Haskell now. Perhaps with all the recent developments it'll pass over to the web?"

No. Haskell never will.

Haskell is a language for the smart.

PHP never was.

If you have an elitist language like Haskell, it will NEVER become mainstream simply because NOT EVERYONE is an elitist and wants to study maths before writing in Haskell.

markus on May 21, 2008 9:49 AM

The thing about PHP is that it's a bad language to learn programming with -- it doesn't teach discipline. However, if you've learned discipline using a different language, it's very easy and straightforward to write elegant PHP code. The crappy parts can be ignored.

Leo Petr on May 21, 2008 9:52 AM

Unsuscribe. This post sucks more than PHP. Unscoped, unreal.

suscribed_guy on May 21, 2008 9:53 AM

Hi Jeff,

I'm about to wager that this post will get a lot more comments than usual. It's already apparent by the comments that it's becoming a holy war of whether or not the language is good rather than regardless of whether or not it's good it still has a purpose and place :)

Stephane Grenier on May 21, 2008 9:54 AM

Thijs - right on! PHP's biggest problem is the inconsistent and messy function naming. Reversing needle and haystack. Making me look up the functions all the time by accessing php.net/function_name.

Otherwise, it's really, really powerful. And fast. And all I gotta do to deploy is place the file in the correct place.

PHP5 and OOP brought many, many web frameworks over the past 5 years. PHP on Trax, Solar, symfony, Cake, PRADO (which is similar to ASP.NET, Jeff), and much, much more.

Once you have those frameworks, developing on PHP is fast. And if you want to speed it up, use a cache like APC or XCache. Only thing is, sometimes these caches seem to fubar my exception handling, and I don't know why. I'm doing some heavy duty shit with it, though.

Now, it's true -- ruby and all these other "fast-CGI" languages have an inherent drawback of constantly having to recreate all your classes, etc. on each request. But with the caches, that's no longer a problem - I have about a 1ms overhead for including a zillion files.

In FACT, PHP is way more powerful and expressive than you imagine when you first start it. With things like $$varname, __autoload, and __call, __set, etc., it can be used to write code really quickly and easily.

I've written an entire MVC + ORM framework in PHP, and I can develop web applications incredibly quickly with it. Take a look, you might like it too:

http://code.google.com/p/pal-framework

That lets you code PHP-style :)

Greg Magarshak on May 21, 2008 9:56 AM

lol @ all the PHP fanatics absolutely losing it over someone else's opinion.

It's ironic the way people can just bash Microsoft all day long, but if you say anything about their stuff simply being "disorganized" they nearly have a heart attack.

But that's just the way it goes I guess...

HB on May 21, 2008 9:57 AM

I used to write ASP and have been writting in Coldfusion for 6 years now. For the first time I took on a php side project and I have to say it is a headache! I'm glad I work with Coldfusion.

Dan on May 21, 2008 9:58 AM

>Unsuscribe. This post sucks more than PHP. Unscoped, unreal.
Did you, Mr. subscribed_guy, perhaps considering elaborating why this post sucks rather than getting offended and stomping out like a child?

Adam on May 21, 2008 10:03 AM

It is amusing to read all of the comments deriding PHP for not being a "golden hammer". PHP is by no means a perfect language, but it does what it is designed to do rather well. It's biggest failing is that it tries to please everyone (and is becoming more bloated as a result).

You want Apache specific functions? There you go. You want MySQL specifics? Got those too. You want to integrate with .NET assemblies? Yep, there are functions for that.

I've only been using PHP for a short time now (working on a hobby project targeting a non-standard browser that does not support scripting), and the only real problem that I've had is that I've been spoiled by Visual Studio's IntelliSense. Since I'm not developing in it commercially, I'm not going to shell out for the official Zend Studio IDE. I've found two free IDEs that seem to work alright for me: Dev-PHP and HateML. It would be nice if the built-in functions were arranged in tiers rather than everything being global, but as long as it works, I'm not going to piss and moan about it.

S. Barbour on May 21, 2008 10:05 AM

I do object oriented PHP (PHP5 has classes) and redefine functions as appropriate. I'm mostly a C# developer and i don't have many complaints with PHP 5.

The OO choice is up to the developers not the language.

Bobby on May 21, 2008 10:06 AM

The problem with PHP isn't PHP itself but the fact that most PHP is the first programming/scripting language that many PHP developers use.

The effect is similar to the old days when some application developers received a VB6 lobotomy as their introduction to programming: they had no understanding of what they were *really* doing because the language was so free and forgiving. The end result was a beast that was so removed from solid programming fundamentals that it tore the soul to maintain and upgrade the code.

This also ties into the "Should you learn C++" discussion that Joel and Jeff have had. The answer, BTW, is ABSOF*CKINGLUTELY. Developers that understand C++ write fundamentally solid code, *regardless* of the languages (which is why C++ experience is a must have at my shop).

Chris Rikli on May 21, 2008 10:22 AM

PHP doesn't suck, it's just amazingly inelegant. You can do everything nearly any web site needs to do using PHP and you can probably build it faster in PHP than any other language. That's not "suck", that's prioritizing goals differently than most other languages.

I like Python and Ruby much more than PHP because they are more elegant languages, but I can't do anything in Python or Ruby better or faster than I can do it in PHP.

shakin on May 21, 2008 10:23 AM

I wholeheartedly agree with you on this post, and here is why...

http://www.merbivore.com/

Merb - All you need... nil you don't.

This is going to be my framework of choice, of course it does use the ruby language (which is way easier to write/read than php, imo). It has taken all the things Rails have taught us, and improved upon them, not to mention slimmed it down.

No code is faster than, no code.

Its more lightweight, which means its faster than rails is, thread safe, and can handle multiple requests better.

Also it can use datamapper, check out this video, http://mtnwestrubyconf2008.confreaks.com/04katz.html

Enjoy!

taylor on May 21, 2008 10:26 AM

@S. Barbour "I've been spoiled by Visual Studio's IntelliSense"

Visual Studio + Vs.PHP = bliss
http://www.jcxsoftware.com/

Chris Rikli on May 21, 2008 10:28 AM

11 years experience programming in C, C++, UNIX, Java, Perl, .NET (both VB.NET and C#), shell programming, VB script. When I first saw php I made an immediate resolution to avoid it at all costs. Why hurt yourself? It's like Perl, only worse.

Art on May 21, 2008 10:29 AM

Coders are funny. They argue that their language of choice is superior while no one gives a shit. I'll be retiring soon from my work coding PHP websites. I'm glad I didn't waste my time time learning what namespaces are. True, we didn't get the job when they asked our company to build Youtube (oh wait, no they didn't) but lucky for us most websites aren't that demanding.

Instead of learning OOPS or OOD or whatever the heck it's called you guys should take some business classes and find out what's important in the real world.

Jeff on May 21, 2008 10:30 AM

Sometimes Jeff you are right on the mark, and sometimes you are very badly off! At least the articles and the subsequent comments are thought-provoking. We could argue about language choices 'til the cows come home, but the startling point you miss is that PHP is open source and has been used and abused by millions of people. Download a LAMP/WAMP installer and it's MySQL and PHP all the way. This popularity and the number of frameworks available make it a great choice for web development for both consumers and businesses. The API is easy to navigate anyway and, if you're familiar with C (as any programmer really should be), half the basic functions are included, as most open-source languages are based on it.

It just then boils down to the fact that good, educated developers write good, elegant code, as opposed to hacking away. Python was developed to maximise structure and elegance: you're a .Net man, look at IronPython; it's implementation via the DLR is changing .Net from the ground up. And no, YouTube was already written in Python before Google bought it out. I can't believe Guido van Rossum commented on this article though, what a legend, keep up the good work!

Daz on May 21, 2008 10:36 AM

This article is offensive in its naivety. Your gripe here isn't that PHP sucks, but rather that you suck at PHP. They are vastly different concepts.

There is nobody forcing the great web-apps of the world to be written in PHP. The reason it dominates is that it is a very useful language - and yes, the code is OO and maintainable when done by people who know the language.

I could spend an inordinate amount of time picking your points apart one-by-one, but for the sake of brevity I will instead say this: please show the programming community some respect and don't EVER publish a review of a language that you don't know how to program in. It's absurd and insulting.

Sorry for the tone... *takes a breather*.

Sean on May 21, 2008 10:38 AM

Sometimes looking back doesn't tell you what's in front of you.

Suckiness is a relative thing. Compared to perl, PHP is brilliant. Back 7 or 8 years ago when all of the existing "big sites" were built it was an obvious choice, a no brainer.

Today, when all of the future "big sites" are being built using PHP to build them is simply retarded. When compared to real programming languages and frameworks available, PHP (an embedded scripting language, always was, always will be) doesn't compare.

It's worth noting that none of the "big sites" run on a Windows platform either which could be argued to be just as retarded.

E on May 21, 2008 10:45 AM

Jeff, please don't repeat the misconception that YouTube is written in PHP. There's plenty of evidence that Python is much more used than PHP: http://www.gooli.org/blog/youtube-runs-on-python/ . Your point stands just fine with just digg, WordPress, and Facebook as examples.

If you don't change your post, people will start citing you as a source. And we wouldn't something wrong on the internet, would we? :)

Matt Cutts on May 21, 2008 10:46 AM

Jeff I gotta disagree with you on this one. I'm an PROFESSIONAL PHP DEVELOPER, as the the spaghetti code thats about the coder not the language. I have well structured, highly optimized code, that other coders continuously work on without any complaint. Thus far I have had 3 C(#, ++) devs tell me they like my code.

Arron on May 21, 2008 10:50 AM

Bottom line, it's too easy to do it wrong, there were even books teaching it the wrong way.

But I've seen action script 2 code that's a nightmare. Imagine the worst PHP, but now complicated by the fact that some code runs on frame 7 or 24 of a timeline. It'll make your brains hurt. :)

Mike on May 21, 2008 10:50 AM

Blame the carpenter, not the hammer. Any tool can be misused.

I disagree but you are entitled to your opinion.

David Walsh on May 21, 2008 11:00 AM

After having spent the last 10 years doing embedded C development, I recently tried some PHP and found it very liberating. Knowing that the language was viewed as very poor, I didn't try to do things perfectly right, I didn't worry about errors, I was able to guess at how to do things (since, many thing seem to have a C like interface) and I was able to get a quick and useful (to me) dynamic site in a matter of a week of starting my personal project. I think that really is the allure. The best part, it's easy to learn how to do almost anything in php due to the vast amount of information out there on the Internet -- think of something and it's already been done and explained too!

Grok2 on May 21, 2008 11:01 AM

>>> I'm no language elitist

Your entire post contradicts that statement.

>>> If you sit down to program in PHP and have even an ounce of programming talent in your entire body, there's no possible way to draw any other conclusion. It's inescapable.

No, not really. Parts of it DO suck, but that is the same with any language. The thing with PHP is that the language syntax is flexible and forgiving enough that you can write some aweful looking code that still manages to function. Whether or not to write that aweful code, however, is completely up to the developer.

Some of the best and worst code I've ever seen has been written in PHP. If it's crap code ... it's the developers fault. And that is true with *ANY* language.

>>> sufficiently talented coders can write great applications in terrible languages

There is no such thing as a terrible language, just terrible developers. Languages are tools, and like all tools, some are more suited to some projects than others. You wouldn't want to screw in a screw with a hammer, right? ... though if you pound it enough, it will probably get the job done, somewhat.

>>> While PHP wouldn't be my choice, and if pressed, I might argue that it should never be the choice for any rational human being sitting in front of a computer, I can't argue with the results

>>> Just don't forget to call the maintain_my_will_to_live() PHP function every so often

>>> It's a galactic supernova of incomprehensibly colossal, mind-bendingly awful suck.

Quips like the above show a great lack of professionalism with this post. If you want to create a community for developers, statements like the above, are the wrong way to go about it.

Michael Morton on May 21, 2008 11:13 AM

Just another case of kicking ass with the worst character in the game. ;)

Kevin Dente on May 21, 2008 11:19 AM

Delphi for PHP does a very nice job of componentizing and adding some structure to PHP development.

Nick Hodges on May 21, 2008 11:20 AM

PHP has some legacy it cannot jettison so easily, but I'm sure they will eventually. For instance, functions with bad parameter order, functions not loaded in namespaces, etc. I'm actually glad they don't to this to soon because otherwise all us PHP Freelancers are borked.

Frameworks (and things like a framework) are the only way to survive with PHP as a PHP Freelancer. Trouble is -- every year there's another favorite, and you end up getting clients who ask you, "Do you know the new X Framework? We only do our work with that." And that blows.

Most PHP projects I inherit are exactly as you state -- SQL and HTML sprayed into PHP instead of keeping it in its place, global variables popping variables into functions like variables out of nowhere, and not even a semi-useful naming convention that lets me know whether someone intended for a variable to be an array of strings or a string or a number or an object.

And, just like you say, it doesn't matter, because it's the PHP guys laughing to the bank. Just type in "PHP" versus any other language at elance.com (under Find Projects) and you'll see that, hands down, PHP is the number one language in demand right now in 2008.

volomike on May 21, 2008 11:21 AM

coming from c++/java/c# is must say: you are so f*** right about PHP. it's a pain in the arse ... it's a mess. the first times i had to build something in php i got tears in my eyes.

but then - php hosting is widely aviable. ASP-hosting (i'd love to do webstuff with c#) is not. php runs on every hosting plan. and that's why i'm using it - i build a site and dish out many copies of it. i just can't afford the money/time to setup a ASP-server for every site i make :/

hell - MS do something about lowend ASP-hosting ;)


oh, and you can write clean code with PHP. PHP5 offers something that's like very primitive OOP. you can build object oriented code with php ... it's just like the language doesn't encourage you to do so. i implemented MVC in php and i'm using my framework now for every project i start. ok, it's far away from the comfort of c# or even c++ but i can avoid spaghetti-sql-in-spaghetti-php-code. (it's nor spaghetti-sql in OOP)

gutscheine on May 21, 2008 11:24 AM

I think a big point of contention is in the ideologies in use. (disclaimer: generalizations in use)

There are essentially two camps of ALL software and web development: There are developers that work in the software industry (where products are made to be sold) and developers that work everywhere else (where projects are to be used in-house).

In the software industry, applications are written using the tools that produce the most elegant and efficient code with the most control possible (C++ and Java). This camp writes the code that works great but takes the longest time to make.

Everywhere else in the real-world, however, applications are written using the tools that will get the job done in the fastest possible way, albeit by sacrificing potential performance. This is the realm of the VB and PHP programmers, where "get it done" takes precedence over "make it fast (performance-wise)"

S. Barbour on May 21, 2008 11:34 AM

I would also recommend looking into the KohanaPHP framework (kohanaphp.com). It is a very elegant PHP5 MVC framework.

neovive on May 21, 2008 11:34 AM

Oh dear, another fucking designer writing about programming languages...

mark on May 21, 2008 11:39 AM

I love PHP. PHP5 in particular was a great improvement.

I think you're sort of right in saying it's a collection of abritrary stuff, and that it is often deployed poorly as 'spaghetti' code.

If anything it's this apparent lack of structure that forces me as a programmer to design my program properly. To use OOP properly, seperate files for each class and keeping a clear distinction between data, structure, and layout.

I've coded ASP.NET (VBScript), and was a proficient user of VB6 way back when. But more often than not I find PHP to be the right tool for the job, something so many people seem to stubbornly refuse to admit.

Lewis Walsh on May 21, 2008 11:41 AM

@Chris Rikli
Unfortunately, VS.php is a tad pricey for hobby programming, and is only for VS 2005 and 2008 professional editions. I'm using VS 2003 Professional and 2005 and 2008 express editions.

Until I make a profit on software I write, I'm stuck with what I can easily afford.

S. Barbour on May 21, 2008 11:44 AM

The thing that depresses me most is that many amazing web open-source projects use php. I use Drupal and Gallery (because of cheap hosting) and I have to fix some things in them. To do that, I write php - language that I really don't like.
I'd better write C# or python, but then much existing code will not be avalable and I will have to rewrite them myself and that's even worse than fixing php.

Vladekk on May 21, 2008 11:45 AM

You are right. And that's exactly my point of view !

Nicolas MASSE on May 21, 2008 11:46 AM

PHP is kind of perfect for everything. It makes life so ridiculously simple, that all programmers think they'll go out of the job since a script kiddie can now make the most compelling web apps from their parent's basement.

Mitch on May 21, 2008 11:48 AM

Fixed: "You've probably heard that sufficiently incompetent coders can write FORTRAN in any language. It's true. But the converse is also true: sufficiently motivated, persistent and masochistic coders can write great applications in terrible languages, too. It's a painful lesson, but an important one."

Calvin on May 21, 2008 11:52 AM

@Keo

"I also came to the conclusion that it is possible to write LISP in almost any language"

What is that supposed to mean? How exactly did you come to this conclusion? Please show us how you can create Lisp-style macros in PHP.

Hint: Greenspun's Tenth Rule.

=)

Felipe D. on May 21, 2008 11:53 AM

=> Some of the largest sites on the internet -- sites you probably interact with on a daily basis -- are written in PHP. If PHP sucks so profoundly, why is it powering so much of the internet?

May be because it facilitates doing things quickly. May be because not everybody earth is a fan of OOP. May be because of its extensive pear libraries. May be because user community around the language. May be because you can use zend/apc engines. May be because you don't need to reimplement everything from scratch. May be because it plays nice with other tools (memcached, mysql, ...). May be because you don't need expensive IDE's to write scripts. May be because its clone of C language with a $ sign before every variable.

Vamee on May 21, 2008 11:55 AM

I just can't get past having to put dollar signs at the beginning of all of my variables. What a PITA.

Dave on May 21, 2008 12:12 PM

Hey Jeff,

I couldn't agree more.
I'm a Java developer born and bred but I write PHP apps for a living.
So I use all my Java experience and knowledge and try to write Java style code in PHP. It helps to keep me sane.

While some languages are definately better than others I really do think that how bad an application is comes down to the coder.

I've written some horrendous stuff in C, and I've also seen some incredible code that makes me want to just chuck it all in and say "I'm not worthy!".

I think that given the best tools, the best craftsmen will create art. Given crappy tools the best craftsment will create someting pretty damn good.
Given the best tools a handyman will only ever create something that is well..... 'home made'.

So yes, PHP sucks. Writing in PHP sucks. Trying to get someone elses app written in PHP to work sucks so bad you could call it a black hole. But it's not a perfect world, and we just have to make the best of the hand we've been dealt. At least it is getting better, slowly.

Trevor on May 21, 2008 12:16 PM

" building a compelling application is far more important than choice of language. "

An excellent point. I'd take it further.

The language you program in is completely irrelevant to the user. Always.

The user will never care, they will only care if your application works, and does what they want it to do for them.

Far too many IT professionals forget this and get lost in the endless complexity (pretty and elegant it may be,) of programming and technology in general.

Alex on May 21, 2008 12:25 PM

PHP contains to many functions - that's one problem you've described in your article. And another - PHP havn't strict convention for functions names (In pressent or in past? I don't know it exactly).

Solution: IDE customization
1. IDE contains (names, documentation, auto completion, ...) only functions, that you know and using.
2. Aliases for functions with one convention that you prefer.

Width this customization your a-functions listing contains less functions and you won't make whattheconventions_thisFunctionHave() typping errors.

Problems width ugly HTML+PHP+SQL spaggetis and so on are problems with:
1. bad programers and bad programming techniques - to many people programming in PHP, most of them aren't (and never in future will be) programmers.
2. Applications are more complex now. And PHP contains to little bricks (functions) to build a house (applications). Building from bigger bricks (using framework or higher type of programming language) is faster. The ASSEMBLER time is gone (no for 100%, i don't mean it exactly), so PHP time will sometimes.

P.S. My english is terrible, i think, but i do my best.

tiso on May 21, 2008 12:29 PM

Anyway, Tim Bray has a problem with just about everything, so saying he's got a problem with x doesn't make x the least problematic...

Agree with the rest of the argument, though.

Bruno on May 21, 2008 12:29 PM

It's all about deployment. I've been migrating some of my own sites from ASP.NET to PHP, because I can host PHP for peanuts compared to hosting ASP.NET.

stevex on May 21, 2008 12:30 PM

I use PHP with the CodeIgniter framework. The documentation (for both PHP and CodeIgniter) is complete, exact, easy to find, and accurate.

The strange part? Other than the syntax, my code looks like C# on ASP.NET, except cleaner.

I have libraries I re-use with every project (user library, custom database-based session handler allowing me to use PHP's natural session handling, a Page class that with minor tweaks will represent any generic page for any project).

My code follows MVC conventions (ASP.NET doesn't necessarily--looked at the SqlDataSource control recently? Embedding database logic in your HTML markup is an atrocity, whatever language it's written in).

Plus, I can build a website from a USB hard drive. Try that on IIS & ASP.NET/RoR--it's an exercise in pain management, if it's even feasible. Not only do my development tools (syntax highlighting text editor, Firefox with all my favorite plugins, GIMP) all run directly from a portable drive without requiring installation on the machine, the server itself (a XAMPP installation including Apache, MySQL, PHP, and PHPMyAdmin) runs completely from the USB drive without any installation required.

In essence, I can plug in a USB drive and turn any Windows XP or Linux machine (yes, this software is duplicated on the drive for Linux) into a full web server, complete with development tools.

I'm not going to say much about PHP's shortcomings as a language. It has several, including the previously-mentioned monstrosities in naming conventions. But every language has these--for instance, Microsoft's FormsAuthentication.HashPasswordForStoringInConfigFile(string password, string hashType) method. There's so many things wrong with that function (which is duplicated in PHP's md5( $strToHash ) and sha1( $strToHash ) functions) that I don't know where to begin.

All I can say is that PHP works, simply because it is agile, runs on anything (including an embedded system with a whopping 200MHz of processing power and a tiny amount of flash-based RAM, as I found from one of my recent jobs), and it has reached critical mass.

One final note:
PHP developers are cheap and easy to come by.
Good PHP developers are moderately easy to come by.
Expert PHP developers are rare as hen's teeth and expensive, but the results will amaze you.

WesleyC on May 21, 2008 12:35 PM

I just wanted to congratulate anyone whom actually reads this far down.

Arron on May 21, 2008 12:39 PM

one word: /\/008

koray on May 21, 2008 12:40 PM

@Leo Petr

you hit it! the discipline! :)

--

"good for getting job done" is a strong and valuable argument but do not overestimate it. In this industry, the job isn't quite done when it's done ;) On the contrary, it just the begining. There starts all that maintenance that could turn into nightmare. And in many cases, it will be nightmare of someone else than the original author..

mantrid on May 21, 2008 12:43 PM

PHP and JavaScript seem to suffer from similar histories. In the past crappy programmers have abused JavaScript and PHP because they're widely deployed and so easy to abuse, and now they have a reputation that they suck.

Since PHP can easily be replaced with another language like Ruby or Python, it's losing popularity. JavaScript is the opposite. It's probably THE most widely deployed language ever, and now that it's at a point where it can be used to write real applications people are embracing it and working to make it useable.

Tom Robinson on May 21, 2008 12:47 PM

Youtube is written in Python. I've spoken to a youtube developer myself at Pycon. Many web apps use Regular Expressions to process the incoming urls which means they can resolve .php, .asp, .html or whatever else they want to. It may be to preserve legacy links.

emperorcezar on May 21, 2008 12:50 PM

PHP is nice because it just works. It can be tricky to scale up to larger tasks, but given that PHP is a language made initially for web development, HTML generation shouldn't take a lot of work. The only thing I use PHP for is developing smaller websites, a task which it is well-suited to.

"Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML" - this still holds true. One of the best examples of what's wrong with PHP is the echo and print functions. Both do the exact same thing, but neither has been eliminated. PHP needs a major restructuring.

Again, I agree that PHP sucks as a Swiss-army-knife language, but for building small-to-medium database-driven websites, it excels, and is practically purpose built. The functions for querying databases, escaping SQL, working with strings - they're all *there*. No dozen packages to import to gain the functionality. It's also nice for web development because there is very little casting of objects.

Essentially, it makes it easy to develop a web application. As far as writing good code, education, and frameworks like CakePHP and Smarty (templates) help.

PHP was the first language I learned, and I was able to quickly grasp programming concepts without being confused and encumbered by more advanced hindrances. I moved on to Java as my primary language, but I've recently been using PHP again to make websites. JSP is great for the large web application I work on, but PHP saves a lot of work when you really just want to start coding.

Tyler D on May 21, 2008 12:50 PM

PHP sucks is incredible misinformed. *Any* language can be considered to suck if it's being written by a programmer who sucks. Yes, the functions are doubled in cases and yes, the parameter lists are annoying at times, but PHP can be just as elegant as any other language, if not more, if a good programmer is writing the code.

Furthermore, compare its execution speed with any of its competitors and I'd bet for PHP more often than not.

I used to be a C# programmer and I have found that with PHP, I am far more productive, I enjoy my programming time significantly more, and my applications are more elegant. Obviously this is subjective, but isn't part of the point of programming to enjoy it, to create elegant solutions, and be productive?

Anyway, that's my 2 cents.

Derek Parnell on May 21, 2008 1:02 PM

Don't mix-up bad programmers with a bad language, most PHP code out the looks crappy and ugly because of bad programmers. It is totally possible to make good working beautiful coded applications where code, data and context is separated.

PHP is as good as C and almost as forgiving, this means that the programmer needs to put more discipline into short, readable and good commented code.

Yaa101 on May 21, 2008 1:06 PM

I'm surprised that the dollar sign thing in PHP doesn't get critique. Every single time Python is mentioned to an audience, who likely have no idea what it is, the use of white space is mentioned as if some kind of original sin that makes whole language impure. I honestly can't understand how anyone with experience from any other language can stand PHP's requirement to use dollar signs to tell the interpreter that the next thing is a variable.
Couldn't the original language designer bother to read a book about compilers and just threw something together?

No offense meant to PHP users. I know that after a while things like typing $ becomes automatic and there is something to be said about having absolutely no restrictions (types, include files, namespaces etc.). If you are really good programmer, you can do good code without any boilerplate. Unfortunately most programmers are not that good.

Bloodboiler on May 21, 2008 1:07 PM

Jeff, did you let Reg write this entry without telling us? Next thing you'll be all "blurb this" and "blurb that".

Ethan on May 21, 2008 1:08 PM

At least you got one thing right "... But It Doesn't Matter". I'd like to let everyone know that at least 70% of the web related programming jobs out there will have you working with PHP, most likely using a LAMP stack. If you'd like job security, knowing PHP is pretty handy as it is the standard for web application development.

The PHP Team understands the problems with the language, the advances being made in frameworks, unit testing and the mass conversion from the bastardized OO in 4 to mostly better OO in 5 are mitigating those issues.

Jake on May 21, 2008 1:12 PM

The article completely missing the point of PHP: ease of exploratory web development *and* deployment.

With mod_php, which is widely available even in most basic ISP hosting plans, developing php is like writing html pages, no additional set up necessary, unlike fastcgi/scgi/app servers required by other languages. Deployment is simple as well, just copy the code directory over and you're done. Rails is simple to development but a bitch to deploy with various additional *required* components to choose/setup. The mod_php model also ensures no memory leaks due to PHP scripts. PHP scales because apache/mod_php scales.

The flat namespace and ill thought out libraries of php are ugly, but with the search function of php.net and the helpful comments, nothing can't be worked around quickly.

Until language elitists figure this out. PHP will be the dominant webapp language for a very long time.

vicaya on May 21, 2008 1:12 PM

Yada, yada, yada, all words. Since PHP is considered by some easier & less verbose than C# then put your money where your mouth is by solving the problem below cleanly & elegantly:

For this XML:

( http://today.java.net/pub/a/today/2004/08/12/groovyxml.html )

I want to get totals for accounts "a" and "b" and then store everything into a strongly-typed collection or list of objects (or failing that hashtable / dictionary). So basically I want:

id = “a”, total = 1700
id = “b” total = 3400

In C# the solution comprises one line, try to replicate that in 1 line or less:

from account in xDoc.Descendants("account")
group account by account.Attribute("id") into accountGroup
select new
{
id = accountGroup.Key.Value,
total = accountGroup.Elements("transaction").Sum(t => (int)t.Attribute("amount"))
};

Anybody up for a challenge ?

Wheelwright on May 21, 2008 1:37 PM

@Bloodboiler
The "$" prefix on PHP variables actually does have a purpose. It allows the developer to embed variables directly in strings rather than by using a substitution function (either explicitly or implicitly) such that rather than having:
print('You are running {0}, on {1}.', sApp, sOS);
or
echo 'You are running ' . $App . ', on ' . $OS . '.';

you can just have:
echo 'You are running $App, on $OS.';

Which one is the easiest to read?

S. Barbour on May 21, 2008 1:44 PM

Was it not the great Bjarne Stroustrup that said:

"There are only two types of programming language:

The type everyone complains about.

The type nobody uses or cares about."

I think that you can judge for yourself, based on the amount of b*thcing about PHP, into which of these PHP falls.

memyselfandi on May 21, 2008 1:55 PM

"This article is offensive in its naivety. Your gripe here isn't that PHP sucks, but rather that you suck at PHP. They are vastly different concepts."


Hehe... good one dude. What I got from the blog is more like "everybody sucks at PHP and it's ruining the language because the sucky features that sucky programmers seem to like (and good programmers hate) is all being rolled into the core language."

This can happen to any language: VB being the prime example. There is nothing fundamentally wrong with VB depending on who you ask. For the most part it is just a programming language. The preponderance of bad VB being set up as "example code" and the developers who aren't good enough to see that the example is bad code, and used it in droves all over the place, caused VB to evolve into a bad code space to be working in.

That is the problem with PHP - not that it's a bad language, or that it's hard to learn or anything. It's that when you adopt PHP, you also get it's whole extended family of crap code, and the crap code that survives long enough seems to be happily folded into the main project as a new function. This is a bad ecosystem to be living in. Survival of the fittest may not be working correctly in the PHP world - and that makes it a bad environment to work in - IF you choose to use the built-in stuff. And if you choose not to use the built-in stuff, then you might as well not use PHP, because it's not much of a language by itself - it's the built-in framework that makes it useful on web sites. And I'm sure there is considerable disagreement over whether functions like a special regex-based substring should be folded into the main project or not.

There's a bunch of reasons why I think those functions should NOT be part of PHP - the main one being what someone else touched on - that it gives me an incentive to not write my own version of the function, and there is no way to choose a different library for that function, or eliminate libraries to make it leaner. You get all the weird functions or you get nothing - not even the language itself.

Jasmine on May 21, 2008 2:02 PM

Let us just start with the old 'its got to many functions' - they may have thrown everything into the toolbox without thinking if it should be in there, but the fact is you do not need to use them, and I probably only use less than 5% of them in a normal day.

One of PHP's greatest advantages and disadvantages is it's simplicity. It allows any old newbie to knock something together which is great, but it also means a lot of very bad code gets written.

Within a well structured team following strict guidelines it can be a beautiful language, coded badly it can be an absolute mess.

I have been programming since the days of BASIC + Assembler (6502,65186) and I have tried most things over the years and always strive for simplicity + the ability to build structured complexity. PHP is the most fit-for-purpose language in the web 2.0 space giving a fine balance between quick to build and scalable given time (and lots of extra's)


Nick Halstead on May 21, 2008 2:13 PM

Whoah, so many comments.

I liked php when I did it. It was way better than (classic) ASP being far more expressive and easy to use framework. It also had a wicked searchable online reference with decent examples to help you get up and running. The quality of MSDN still isn't always on par for how good that online help was.

Sure the name of some methods suck, but really, if they wanted to change that, they could. You get used to these things.

I think the benefit of compiled languages like C# are the fact that they work better in large teams. There's also a lot of benefit to catching errors at compile time. Stuff like ASP.Net does integrate better into a windows infrastructure. Let's face it, there's a lot of windows infrastructure out there.

Popularity doesn't mean it was done well at the start, but popularity means everyone knows it (and probably hate it to a degree). But it gets the job done in the end, and no methodology gaurantees that, no matter how pretty or perfect it is. Like windows, it's not the best, but it sure is popular.

Seriously, C# is great, but sometimes I get the feeling that there are too many teams in MS pushing too many technologies. My brain can't keep up. I should become a manager I guess.

overloaded on May 21, 2008 2:19 PM

All languages are collections of arbitrary stuff borrowed from other languages. And arguing about how pretty one language vs. another one is like arguing about which language you should use to write a recipe for a cake.


Frank Goertzen on May 21, 2008 2:20 PM

PHP is an interpreted language. That alone should make you want to use another language.

Steven Rogers on May 21, 2008 2:27 PM

Well, really, PHP 4 sucks, and PHP 5 isn't all that bad. The PHP 5 object system is pretty decent, and PDO (which is available for PHP 5 and standard with PHP 5.1) is a decent way of accessing a database. The problem is that almost all PHP code in existence is PHP 4, and the PHP developers I know are hardly aware of PHP 5 features, mostly because their hosting companies haven't upgraded yet.

-Max

Max Kanat-Alexander on May 21, 2008 2:35 PM

Like others have said, crappy code can be written in any language. PHP just has such an unusually low barrier-to-entry for new programmers that you end up with a lot of people slinging around crappy code.

I've seen some absolutely brilliant engineering done in PHP. There's plenty of modern software constructs available in the language, and plenty of frameworks are available if you really want to make your solutions clean.

I've heard all the arguments before, and like you say Jeff, they really don't matter. When I started coding in C I was constantly looking up library function names and parameter lists, even though they were all logically consistent. Even though you can argue that PHP's function names aren't consistent, that's relatively unimportant to experienced programmers who have most of the commonly used functions and their parameter lists memorized. Not to mention that the manual is fantastic.

"no sensible framework baked into overall product"

Why on earth should a framework be baked into a language and thrust upon you? Separating your framework from your language should be a language designer's primary goal, not something to be avoided...

Bob Somers on May 21, 2008 2:37 PM

i couldn't disagree with you more Jeff. php, as a language is easy and sensible. there are a LOT of library functions, but you're making the wrong comparison. if you put php side-by-side with VB + .NET, you'll find that php does what a web developer needs and is simpler and more efficient. i've used both, and will use both again (though i lean more towards c# in the M$ world), but my preference is for php.

marty nickel on May 21, 2008 2:39 PM

Also, it might be interesting to do an article on how almost every "X Language Sucks" article or comment in the world is written by people who have never used X Language extensively, or by people who don't have a good understanding of the features of X Language, or by people who have only used one language and think that any language that works differently automatically sucks.

When I was discussing alternatives to Perl with people, the defenders of Perl were uniformly people who didn't have extensive experience with any other language. Defenders of PHP 4 are often the same--they don't know anything about any other language because they *don't have to*--PHP is so popular that they could program in it for the rest of their lives and never see another language. I'm not saying that either of those languages suck--they have their uses. I'm just pointing out that it's interesting that most of the arguers in this field--on either side--are uninformed.

-Max

Max Kanat-Alexander on May 21, 2008 2:44 PM

Very good article!... I agree, PHP may have its downfalls, but all can be resolved with good coding practices, and future releases. The same thing has happened with dozens of other "non-professional" languages. Also, PHP is easy to configure and install, regardless of the machine it is on, and all of its weaknesses are well-documented, with work-arounds readily available to everyone. Also, I think an environment where you *can* make mistakes will teach you not to make them more effectively than one where mistakes are impossible, or unlikely.

To use an analogy:
Fancy running shoes won't make you a sprinter, the best ingredients in the world won't make you a chef and world-class paints and paintbrushes won't make you an artist... only hard work, practice, patience and some talent can.

I've always thought that learning how to *program* is more important than learning a particular language, or how to use a particular editor.

Thomas Borzecki on May 21, 2008 2:48 PM

PHP is so popular for a few reasons:

1. It sucks but it's a modern-day kind of suck. Not a 10 years ago kind of suck which is altogether a different kettle of fish.

2. The WWW is still young enough that you can get a lot of eyeballs with applications that are of the "low hanging fruit" variety. Put another way, the apps aren't doing terribly complicated things but what little they do can be popular because we haven't gotten to the more complex things yet.

3. A lot of the complexity lives on the client via javascript or HTML. So PHP is mainly a glue for generating the right HTML/javascript.

4. A lot of the complexity lives on the server (I'm thinking RDBMSs, back-end processing, etc...).

I expect most of those popular websites to move to a more structured framework by the time AJAX 2.0 is passe. They'll crumble under their own weight if they don't.

PERL apps followed a similar trajectory. PERL was so easy to use that you could get a working product out the door in much less time. By the time you're on your 6th version, feature creep + a too-freewheeling language have prompted a rewrite in either java or C++...

alephnaut on May 21, 2008 2:50 PM

The 180 comments in this page shows only one thing:

PHP IS THE MOST FUCKING POPULAR LANGUAGE IN THE PLANET!!

It doesn't suck Jeff, you are just a shitty programmer LOL xD

mark on May 21, 2008 2:56 PM

God... I don't think I've ever seen so many elitists on one web page.
The hammer is only as good as the carpenter, plus, how many hammer do you get (which are free to the public) which don't break?

Some of you assholes need to get over yourselves.

Wolf_22 on May 21, 2008 3:22 PM

Reading these comments further, if you take nothing else away from this lesson (beating?!), Thomas Borzecki has written one of the concisest, yet most useful comments I have ever seen, particularly the last sentence. Heed and learn, then maybe TRY using PHP (or PHP.net?) or any other language/environment properly before slating it!

Daz on May 21, 2008 3:29 PM

I would have to say, coming from Java, PHP was really easy to pick up and start using almost right away.

I am still not used to the Asp.net (VB) and have been using it for almost a year at work. I understand it's a framework but some of it is so hard to use. HttpContext.Current.User.Identity.Name to get a username instead of $_SESSION['username']. Just seems easier. Less stuff to deal with. $_GET, $_POST, $_SESSION, $_FILES is all I really need to know about PHP. Asp.Net there's just so much more to pick up.

But i guess theres a give and take in any situation.

I love Visual Studio, the best IDE i have used however, the new Zend Studio is pretty good too and does have support for Refactoring. OOP and exception handling in PHP 5 are fine with me.

Mike CEZZER on May 21, 2008 3:29 PM

I don't know if you're being entirely fair. Having so many functions is evidence of:

- How far PHP takes you before you have to do any of your own library writing, and
- The historical lack of namespaces (coming, I believe, in PHP6).

Re: function name conventions: functionnamelikethis() and FunctionNameLikeThis() are identical. PHP function names are not case sensitive... Admittedly having this_convention() and thisConvention() is kind of a kludge, but it's like that for historical reasons.

And browsing the PHP.net function library will get you 99% of the info you ever need.

@steven rodgers, I suppose you write your websites in C++? Everything else is bytecode or interpreted. Don't be such an elitist. Did you know PHP compiles to bytecode if you use an optimizer? There are many options, many of which are free.

PHP does some wonderful things and the key is that, like C++, it supports many programming approaches and it's up to the developer to follow best practices. (Heck, it even has anonymous/lambda functions, besides objects, literals, and the usual.)

Note, though, that Facebook is partially PHP and partially C++ and Erlang and other languages.

Alan Hogan on May 21, 2008 3:39 PM

I read PHP's rand function. I read what their developers said about it. They are fools, they know nothing about seeding they know nothing about their silly rand function. rand is broken on win32 because the developers made stupid assumptions and then got blown away by casting floats to longs and assuming their bits were random.

PHP sucks, PHP devs are pretty awful, developers who use PHP - grow up.

PHP ELITIST on May 21, 2008 4:01 PM

Hey Jeff,

I think you failed to mention that Yahoo! is one of the largest PHP shops around. At MIX during the interview of Steve Ballmer by Guy Kawasaki, Steve mentioned how Microsoft was the biggest ASP.NET shop around. Then Guy mentioned that Yahoo! was the biggest PHP show around. Steve followed that up that if the Microsoft merger with Yahoo went through, Microsoft would be the biggest ASP.NET shop AND the biggest PHP shop.
Although PHP has more warts than a hundred toads, that doesn't mean you can't write clean, well-designed code with it. As already mentioned in previous posts, there are various MVC frameworks written in PHP, and there are developers who write object-oriented, n-tier code with unit tests, etc. By the way, most of the crappy PHP out there is written in PHP 4, PHP 5 is a completely different ball game.

Robert Biggs on May 21, 2008 4:09 PM

I think the problem with PHP is the same as with Javascript: too many people have access to it. We all hate Javascript because of the astounding amount of bad Javascript that is out there. And there's a lot of it because everybody with a browser has a compiler. PHP is on most every Apache server out there, so non-programmers who just have a website can use it. It's a step away from Javascript's ubiquity, but close enough.

I write in PHP, but I come from a COBOL background, where I had to structure everything just write and keep under the 4kb memory limit. My stuff is clean, so I will defend PHP as a tool.

As far as apps available written in it: I totally agree that most are worthless.

Chris on May 21, 2008 4:25 PM

it all depends who's coding...

Tim on May 21, 2008 4:35 PM

No, we all hate javascript because of all the subtleties in different browser implementations. We all hate html for the same reason.

Maybe installing PHP has become easier, but I don't recall it was 'easy'. A real pain when you have to verify PHP on the machine is set up to the applications needs. You had to know what modules were in use and get/compile them if missing. Failing to do so broke your php app. When you went to upgrade, you had to remember the union of all modules in use across all applications and hope that there were no breaking changes.

No better than COM objects in classic ASP land, but it's worth mentioning to the rosy glassed crowd. It's called DLL hell for a reason.

I don't use php anymore, so maybe it's better now as more things get folded in. Heck, that's probably why there are so many things folded into the mainline trunk.

RE no framework ... PHP is a framework. How does it have $_GET and $_POST for variables in html request/responses if it's not got a built in web framework. ASP.NET is a framework for web pages in .net, but C# itself doesn't have a framework. ASP.NET doesn't force n-tier, but it is capable.

n-tier is just a logical way to separate responsibilities, it's not anything a computer cares about when executing code. It's a layer of abstraction for the monkeys on the keyboard.


installer on May 21, 2008 5:21 PM

For platform independent web applications I believe that PHP is one of the better choices. It is in no way an elegant OO language even though OO has been introduced recently. The list of functions IS scary and have all sorts of problems as mentioned previously.

However, despite the lack of objects encompassing the built in methods it is very possible to design and code well thought out solutions. The language doesn't FORCE you into good design, but it's available for the taking.

I have no doubt the language will evolve to the point where good design is encouraged if not enforced, but for the moment - it seems to be one of the better options if the hardware/software platform is undefined.

`Josh on May 21, 2008 5:23 PM

Alright it's like this...

I pay about 100 dollars a year total to host lots of web sites, most of which I coded in PHP because the WEB HOSTING FOR PHP IS CHEAP! And I'm cheap. And the hosting to do a ASP.NET site is expensive.

And to do down and dirty cheap stuff that doesn't require a whole lot, it's easy to mock it up in PHP. I think it just grows past that. Facebook was probably just mocked up in PHP and then it kept going because it was too hard to convert.

Long live the ghetto king of the web languages, PHP.

Matt on May 21, 2008 5:24 PM

> If you want to create a community for developers, statements like the above, are the wrong way to go about it.

I'm just trying to be honest about my deep misgivings with the PHP language. It has some rather severe architectural problems, more so than any other language I can think of. Even my beloved, much-maligned BASIC.

Also: those statements are deliberately over the top. It's supposed to be a little wry, a bit tongue in cheek. You know, humor?

That said, I absolutely think it's important for PHP devs to be aware of the architectural limitations of PHP, and understand the alternatives. I'm not asking them to stop coding in PHP, just to have some context.

But as I said in the post -- results are what matters!

Jeff Atwood on May 21, 2008 5:38 PM

Joomla , my favorite CMS is written in php...
most popular boards (phpbb , smf, vbuletin etc) are written in php.
Myself I write some script in php.
I love the simplicity of it.
I love the incredibly big collection of function, that allows to do almost anything. I doubt for instance, that there's a Levenshtein function in ASP.
Who would care if the "english human language" wasn't perfectly designed, if you can express anything you want with it ?
That's the same with the computer language php: I can program anything in php , and everything is well documented.

mehdi on May 21, 2008 6:12 PM

There is one big secret in software, which is known to everyone, who has some experience in the *reading* of code: the dominating majority of software is messy unmaintainable crap. There is another secret, which is known to ones who is used to read a lot: the code written with newest OOP concepts in mind is much more messy and unmantainable comparing with simple traditional procedural concept. It is so easy to replace one function call by another one. It is much harder to replace class hierarchies.

vtolkov on May 21, 2008 6:20 PM

WOW JEFF!!!

I didn't take you as a microsoft apologist, but saying PHP Sucks is ignorant.... you can't have it both way naming some of the biggest sites currently on the net and arguing that they all are using terrible langs is outright offensive.

Seeing how facebook was written by a couple of people they would've picked the best language available for them to achieve results.... I'd hate to break it to you, but ASP is not a good solution, and I'd take PHP over ASP anyday....

EB on May 21, 2008 6:25 PM

One point that struck me when I read this article was:

> You've probably heard that sufficiently incompetent coders can write
> FORTRAN in any language. It's true. But the converse is also true:
> sufficiently talented coders can write great applications in
> terrible languages, too. It's a painful lesson, but an important >one.

Seeing how these successfully and *functional* these large projects have been, it's important to look higher than the language it was implemented in. When I see Wikipedia, I think of the immense contribution of data and knowledge, not the PHP scripts that power them.

On the other hand, for aspiring software engineers, it's more important to choose the cleanest and most maintainable approach to making the next useful app. Just because other successful projects have used PHP, doesn't mean that PHP is a good choice to build with. This also applies to whatever language is in vogue at the moment. A designer should choose a framework like Ruby on Rails for it's technical merits rather than the hype around it.

Jerry on May 21, 2008 6:39 PM

I tend to like programming languages that everybody else complains about, like C++, Perl, Javascript, Visual Basic, and PHP.

All of those languages can be ugly, all can have weaknesses, all have some bad design here and there.

But they all work, they all get the job done, and all are in widespread usage.

I agree with another poster, who put it very well - comparing these so called "ugly" languages to great cities like New York, Paris, and London. Those cities have dark underbellies, and rift-raft, and crime and poverty, and so on. But they're great cities that are homes to millions of people, and are visited by millions, and are exciting. Then the other poster compared more "pure" languages, like Java, C#, Python, etc, to works of art - very beautiful, but limited in usefulness.

Anyway, I love PHP. It's fun, easy, productive, flexible, powerful, efficient (for an interpreted language), and extremely useful. PHP, much like C++ and Perl, can be really ugly. But also like C++ and Perl, it's extremely useful.

To solve real world programming problems, I'll take utility over beauty any day.

Besides, PHP has scoreboard - Yahoo, Facebook, Tiobe, Wikipedia, YouTube, Word Press, Sugar CRM, and so on. A language that truly "sucks" simply can't produce great web apps like that. A language that is perhaps ugly, but useful, does.

JeffS on May 21, 2008 6:50 PM

Saying "results are what matters" is like saying "we should kill our current set of politicians and lobbyists to deal with economic, oil shortage, food shortage and global warming problems."

And by the way, your sense of humor about PHP? It sucks.

And arriving to the conclusion that PHP sucks on the quality of code written by anonymous? It's hardly fair to a language that can be easily picked up by beginners.

What would be interesting to know is how well does an average person without programming experience picks up any language within a time constraint.

everling on May 21, 2008 6:55 PM

100% agreed. I started with assembly, moved to C then C++, then to Perl and Java (per for quick CGI and Java for "real apps". I woudn't touch "Personal Home Page" for anything.

About 4 years ago I changed my mind, and for exactly one reason: every commercial hosting account you can get - from $1.99 / month up, supports PHP.

Nick on May 21, 2008 7:02 PM

>>The only conclusion I can draw is that building a compelling application is far more important than choice of language

Pfft. PHP is good at what it does, and sucks at what it's not designed for.

It's like claiming PERL sucks (merely) because it has a very dense syntax, or because it is terrible at high performance computing.

PHP was designed to embed code inside of HTML pages, and it does it very well. tag tag tag... "Hello <?=$name?> how are you today? I see you have <?=$wallet?> dollars left in your wallet."

It's fine.

Bill on May 21, 2008 7:20 PM

> You can make bad code with anything.

And the converse is also true: you can make GOOD apps with anything -- that's the point of this post.

Jeff Atwood on May 21, 2008 7:38 PM

"If you have an idea, PHP gives you a quick and dirty 1.0 (a la 37signals) implementation for cheap."

Um, well not really at least if you consider that 37signals stuff is all written in ruby on rails ;-P

Bunglemeister on May 21, 2008 8:00 PM

PHP might not be as elegant as Python but it's a still a very good language to get 'something' done. I think it's the quality of programmers/developers who apply a language to solving problems effectively that makes a difference. Any fool can write bad code in Ruby or Python as much as PHP. But nobody will disagree that PHP isn't the most well designed language or has a well thought of library.

With all that said I don't think the PHP development community should rush into patching PHP up to look/feel like Python or Ruby. Let PHP progress in it's own path - you can never have too many alternative tools to solving problems.

Rohit on May 21, 2008 8:03 PM

Jeff, you really really need to learn the difference between a language and an API.

Meanwhile, a language which sucks so bad and has no financial backing still comes out with a higher market share than the language you defend so often and has the world's richest company peddling it... doesn't it just get to you?

Oh, it does. But it shows only a little.

Andrew R on May 21, 2008 8:21 PM

SimpleTest[1] is a unit testing framework for PHP. It's growing in popularity in the PHP world, and at least one popular PHP project (Drupal) has adopted it broadly for both core development and many contributed modules.

[1] http://simpletest.org/

Sam C on May 21, 2008 9:05 PM

What's wrong with FORTRAN? It's just BASIC from 1960.

Miles Archer on May 21, 2008 9:27 PM

Why on earth do so many people seem to think that whether PHP sucks or not is in any way related to whether ASP.NET or anything else sucks or not?

The central thesis is that PHP sucks (to develop with). Doesn't matter whether ASP sucks, or whether Microsoft sucks, or whether PHP has been successfully used. What matters is that PHP sucks.

And for god's sake, the fact that facebook was developed using the tools the people making it knew, not tools that came out of a comprehensive study of which language sucks the least. I know I've done a thing or two in the "wrong" language, because I didn't know about the right one, or I knew it but the cost of using the "wrong" language was less than the cost of learning another language and I just wasn't feeling the "20% programmer" vibe at that moment, or because there was some library of code that did 90% of what I wanted which only had easily accessible APIs in language X, or because the last guy working on it used that language and his code wasn't so horrific that it was better to throw it away and start anew.

Disclaimer: I don't personally know if PHP sucks. Never used it. I've done a very slight bit of ASP.NET on my own time because I was working with something written in ASP. I'm a Systems Programmer, for the most part. I use C, and sometimes C++ except avoiding those nasty performance-sapping things like exceptions (yes, yes, I know -- and yes, the perf is so important that it's the right call). Delve into some assembly now and again on a variety of embedded processors but also x86 and amd64.

When I want to do something quick and dirty I use Python because I know it and it's like C but without the agony. My point is, I don't know if PHP sucks. I just know that most of the things you've said are irrelevant.

Ens on May 21, 2008 9:39 PM

See what you've done, Jeff - you attracted the attention of the people who write "Perl" in ALL CAPS. Didn't you know that if you insult a language, you'd draw out its proponents in droves? Given that inevitability, what did you think would happen when you insulted a crappy language?

It never ceases to amaze me that there are so many people who ignore the difference in quality between languages, because hey, they're all Turing-complete, ain't they! I *can* write bad code Ada, therefore I might as well use VB to code everything... right?

It's tough to get into the minds of these folks. My current best guess is that learning a second language would be way too much effort.

Josh on May 21, 2008 9:46 PM

>>It's tough to get into the minds of these folks. My current best guess is that learning a second language would be way too much effort.

Pfft, I've programmed in pretty much every major language out there, from FORTRAN and ALGOL-60 to C/C++, Java, ML, Python, PERL, and yeah, PHP. I pick the right language for the job (though ML is never the language, to be honest). I certainly wouldn't use PHP in most of the situations I use the other languages.

PHP is great for doing CGI. It was <i>designed</i> for CGI, and so it's no surprise that it's better at it than other languages.

Generally speaking, with traditional CGI, you have a program (in C, PERL, Python, whatever) emit a HTML page. In PHP, you have a HTML page with code naturally embedded inside of it (though you can invert it and think of the close tag as an emit statement). It more naturally fits the mindset of the programmer.

<b>The most important thing in software engineering is preserving the good mindset of the programmer.</b> I think people get too caught up in trivial nonsense and forget this.

Bill K. on May 21, 2008 10:23 PM

This article certainly exposes some of the worst aspects of php, along with some references that support the idea that php is indeed a sucker's language. But I must disagree.

Php has lots severe errors.
* Inconsistent function naming
* Inconsistent function parameters order
that's it.

Php has some not so severe errors
* Not all libraries are object oriented
* Incomplete type hinting for functions and methods
* No hinting for class attributes

Php has some other false errors
* Not a fully object oriented language
* Not a type strict language
* Not a compiled language

This set of errors and apparent errors make the language look like it sucks for people not familiar enough with the language, strong paradigms about how a language should be, and a large set of unexperienced programmers.

But all this gives php several powers over other languages.
* It is very easy to face the language for new adopters
* It allows to get simple things done quickly and easy

And also some weaknesses
* It allows you to make a mess easily
* It requires discipline, not rules, to code well

So how to code well in a sea of poorly written php code when you are learning?
* Use some rules (any of them but use them)
* If you are going to scale code well
* Avoid coping the errors of the language
* Code using best practices, and use object oriented programming
* Comment, test, reuse, and all those good programmers voodoo magic

How to accomplish this if the language sucks?
R: The language does not suck, it just has its manners.
Php fully supports Object Oriented programming, Unit testing, Patterns, Some kind of overloading, caching, security and all that stuff people think about a good programming language.

* Wrap all the language inconsistencies in classes, and make them consistent, some day that will change, so be prepared.
* Use patterns like MVC (Model View Controller).
* Use Frameworks (either adopt one or make it).
* Type Hint your method and function parameters
* No namespaces?? come on, make an object and put your stuff in there. you dont depend on the instruction namespace for that.

Examples:
Namespaces in php (correcting the global variables nightmare)
<?php
class DemistifingNameSpace
{
public static $names;
public static function set( /* String */ $name, /* Mixed */ $value )
{
if( !is_string($name) )
{
die( 'Fatal Error: $name must of type String on DemistifingNameSpace::set()' );
}
self::$names[$name] = $value;
}
public static function get ( /* String */ $name)
{
if( !is_string($name) )
{
die( 'Fatal Error: $name must of type String on DemistifingNameSpace::set()' );
}
return self::$names[$name];
}
}
?>

There it wasn't that hard right?
well improve that class with comments, support for subnamespacing, better validation and some other cool stuff and you avoid collisions.


So to conclude, the languages does not suck at all, you got all those cool and well written frameworks, applications, and classes that can aid you to take away the pain to normalize the language errors.

So good look. and be a bigger programmer, not a bigger sucker, so they say.

Fernando Trasvia on May 21, 2008 10:27 PM

First off Jeff I have to say i often sympathize and cringe when you speak. I am a listener to the "stackoverflow" podcast injoy listening too. I know joel gives you a very hard time, and sometimes it is not warnented, but I’m afraid you just run right into it, stop defending the fact that you don’t know C and don’t need to, that’s like going to Europe and getting by only knowing English. You’ll be able to get done what you need and not die in the processes, but you’ll get beyond being just a Yankee hack. Don’t expect to get the best food (best libraries) or get advice on where to really go (the best spots). Unix and sourceforge are built on c libraries, and if you want to get out of the kiddie sandbox you need to know C.

This article is most or less correct. PHP is not an elegant language and it doesn't matter. All scripting languages are the same for me, getting stuff don’t is just a matter of using some guys library. the only difference is how much the language will get in the way. i know perl, php and python. Here are my views on each.

perl -- lots of modules, lots of ways people use them. i can write perl "ok", but i can't read it for shit, everyone who "knows perl" thinks they have to write everything in "perl sanskrit" and regexe's. great for other perl ninja’s useless for anyone who isn’t a born again perl developer.

php – PHP people feel that modules is just more shit to download, we'll just have _everything_ in the language but just not document it or support it through the versions. Want to start your coffee machine with your roomba, no fucking problem. Want to parse "xml", good luck figuring out what php5 actually supports, turns out 1/3 of the shit on the php.net page is out of date and useless.

python -- haven't used it enough to be as critical. but from what i can tell so far it has the module support perl does but a language that is simple enough that even perl fuck monkeys don't go making a bunch of unreadable python.

Jack on May 21, 2008 10:32 PM

I was an ASP programmer for many years and then I did a few things in PHP and thought it was great because it seemed so similar to Classic ASP. But after moving to .NET, ASP and PHP really do seem like huge unavoidable spaghetti code mess generators. Every piece of existing PHP code I've seen looked like a total mess. I completely agree with your article.

Adin on May 21, 2008 11:35 PM

I programmed in Perl, Classic ASP, PHP and ASP.NET/C#.

IMHO PHP code sucks if you want it that way. While classic ASP offered no alternatives in style (unless you coded your COM class to encapsulate needed features, which moved the problem into "DLL Hell" area), you *could* always write a (limited) class library in PHP.

Nowadays, there are lots of alternatives in PHP if you want clean, structured, MVC-compliant code. My favourite is CodeIgniter: structured enough to keep your code clean, relaxed enough to allow you to delve into low-level mode if you *really, really, really* want to.

MaxL on May 22, 2008 12:19 AM

As a few posts have mentioned, Drupal is an example of a successful and practical implementation of a web content management system in PHP. I have found it easy to modify the Drupal PHP code on my own site to tweak details. I have done OOP for years mostly in C++, OOP is overrated.

Anyhow, to answer why PHP (and messy stuff) is so prevalent, you'd want to read this to get the gist:

http://www.laputan.org/mud/mud.html

fizz on May 22, 2008 12:31 AM

(is your captcha stuck?)

What I found most annoying about php, apart from the inconsistency in the library, is that PHP5 is so much nicer but my application is a installed app, not something I host, so I'm stuck with the lowest common denominator. It's actually tempting me into switching to a compiled language and making binary distributions instead - something I can't do with php, although I could with perl+par - or to a language that hasn't sucked in living memory, so I don't suffer the same way with old versions. It would need to have a decent built-in library too.. Perl, Ruby and Python seem to be the candidates, although perl is sometimes a lot of grief to install modules, too.

Die PHP4 Die!

Howard Jones on May 22, 2008 12:37 AM

Dear Jeff Atwood,

Java had a lot of namespacing, n-tiering, and ooping & etc.

while at the same time PHP had a lot of String manipulation & Array digging functions & etc.

This was the major differences once a time between both languages -and cultures- but now as Java has Collections Framework and PHP has developed a full functional OOP universe.

Being developing on the two platforms for the last days I can assure that when
in Java manipulating Strings I'm still sucked thinking how easy it will be in PHP...
and when in PHP dealing with fake threads I'm sucked thinking how easy it will be in Java...

Both platforms (I'm talking of what *really* I know) have they weakness and they strongness and critiquizing a Language for what others said or for what functions started named with * is not what the regular readers of CodingHorror are expecting.

And one real major difference is: the last thing I'm loving PHP is that is a real open language where all the concepts I learn while dealing with Java's frameworks, etc. I can easily transport to the next PHP app that I will develop but Java as is really strong typped and strong namespaced I can say the same.

Also one of the majors facts that let PHP success on a lot of 2.0 webs is the fact that the engine itself does not overload your apache neither your database, as the resources are sized and optimized at extreme reates.

Finally is true that the vast major developers niche for PHP are amateurism but this is again not a real reason to not to love PHP. All we had seen a lot of unmaintainable Java apps and we don't fall to develop again on this or that language for this reason.

I suggest to try for yoursef with http://www.symfony-project.org/ framework for instance or the ORM http://www.phpdoctrine.org/

Best Regards,
Jaume Teixi

Jaume Teixi on May 22, 2008 1:45 AM

@Wheelwright

foreach (simplexml_load_file('groovy.xml')->account as $account) foreach ($account->transaction as $transaction) $totals[(string) $account['id']] += $transaction['amount'];

PrettyCoder on May 22, 2008 2:08 AM

Go PHP! :)

Its terrible and suffers from the "a function for everything because I don't really have any libraries" problem... but its great fun, and the only server scripting language that I feel comfortable using for general purpose web stuff... the learning curve is tiny and the reference is good. So unlike ASP or Java I have to learn almost nothing to pick it up and use.

i.e. I use PHP cos I'm lazy. :)

Jheriko on May 22, 2008 3:38 AM

I was wondering, how good is Ruby on Rails?

sushi on May 22, 2008 4:44 AM

You Sucks, But It Doesn't Matter

David on May 22, 2008 5:11 AM

The ugliness of a solution isn't given by the language used, but by WHO developed that solution.

coditza on May 22, 2008 5:18 AM

"Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places."

This describes my current project PERFECTLY!

Matt F on May 22, 2008 5:29 AM

Jeff, you spelled it out nicely. I'm on a project right now that is php. No biggy right? well I should mention that we are a Java shop by nature and could not build the solution we needed fast enough in java to warrant using it on this current project. I hate php but I'm using it and I feel dirty every time I have to write a function that uses globals or passes by value or directly calls sql. I know this project won't be maintainable but thats not what we are concerned with - its getting it out there and seeing if it sticks to the wall. Thats probably a philosophy shared with facebook, youtube, digg etc... get it out there first and then make it better. Its also funny that you mentioned VB as I could argue that Microsoft was one of the first software companies that used the "get it out even if its crap" mantra.

Cheers

Kristan "Krispy" Uccello on May 22, 2008 5:45 AM

Let me paraphrase your argument to see if I understand your criticism of PHP.

PHP is the most horrendously bad programming language in the world because it has waaaaaay too many functions that start with the letter 'a'. And not only that, it's also horrendously bad because it is so easy to use that anyone can program in it, like HTML. And all these idiots don't know how to program. Therefore, PHP sucks. Oh, and it's a big joke that the words in function names are separated by underscores. Everyone knows the right way is to use camelCase.

Is that the gist of it? Did I miss something?

biff on May 22, 2008 6:19 AM

Krispy says:
> I hate php but I'm using it and I feel dirty every time I have to write a function that uses globals or passes by value or directly calls sql.

Then don't do those things.

fred on May 22, 2008 6:23 AM

Fred,

I would except that we have inherited code from a 3rd party and are stuck right now doing things the way their "framework" lays it out. The method by which the database connection is setup and the way you manipulate the models (which are really just direct calls to the db tables) has already been defined by this framework so its either re-write it (losing the time gained in using it) or conform to their way of doing things in the interest of moving fast and keeping the code base consistent. The default behaviour of PHP is to pass by value not by reference and yes you can override that using the & operator on your parameter passing but again when using a pre existing code base that does not do that it means you will inevitably introduce side effects that are hard to diagnose or fix.

Kristan "Krispy" Uccello on May 22, 2008 7:09 AM

@Kristan "Krispy" Uccello

Seems like you are working in PHP4 while PHP5 is already available for about 5 years.... And the problems you state are problems with the framework. Not PHP. In PHP 5 passing by reference for objects is default .

m0s on May 22, 2008 7:20 AM

@m0s

You are correct - the framework was written in php4 even though it was released not too long ago. I guess the issue is really that a language (any language) carries with it the legacy of its creation. I know php has come a long way in its existence and will most likely continue to get better. But even as it gets better there will be those who do not use or pick up on the improvements. I see every language as a dirty snowball rolling down a hill. Rails for PHP is new and looks promising as is the PHP unit frameworks (still a little cumbersome compared to things like RSpec though) and I'm sure there will be many more improvements in PHP like this - If you read my earlier post: I did decide that PHP was the way to go for the current project but I still feel the burn of not having the ease of use of the other tool sets/libraries etc that I can leverage in other languages/frameworks.

Back to your comment: yes many of the problems are in the framework I am using but it was PHP that allowed those problems to exist.

Kristan "Krispy" Uccello on May 22, 2008 7:52 AM

The lesson of PHP is that human factors, *not* engineering, drive the process of language learning and use.

Most developers learn from tasks for projects. They have to get a task done - quickly! So what do you expect them to do? Learn Perl or C++ to get a working web page up?

Languages that make things easy to begin (e.g. php, vb6, python) tend to win. More powerful languages lose, regardless of other desirable characteristics.

A good language would combine these two - making common tasks easy and more complex tasks possible. For the web, ASP comes closest, IMHO, closely followed by Java and Javascript. Vb.net and C#, have done this for Windows apps.

Something like C++, for all its power, is probably doomed to become a niche language, while for the web, Java is probably just easy enough to stick around forever.

ThatGuyInTheBack on May 22, 2008 8:12 AM

Jeff, thanks for updating about YouTube; I appreciate it, and really enjoy your site. I'll step out and let the PHP discussion rage on now.

Matt Cutts on May 22, 2008 8:50 AM

I find it extremely funny how many people completely misunderstood the article. Jeff, maybe you could do these morons a favor and avoid the humor and sarcasm - they obviously don't get it.

If you're about to make a "PHP doesn't suck" post - go back and RTFA again...

Jasmine on May 22, 2008 8:52 AM

Jasmine :

Who told you that insulting people was the best way to get your point across ?

manu on May 22, 2008 8:58 AM

Stuff that proves PHP is continuing to mature as a serious programming language:

* Build System: Phing (http://phing.info/trac/)
* Continuous Integration server: Xinc (http://code.google.com/p/xinc/)
* Eclipse PDT Project: http://www.eclipse.org/pdt/
* Endless Frameworks to choose from: http://en.wikipedia.org/wiki/PHP_frameworks#PHP
* Plenty of Object-Oriented support (and still growing)
* According to the internals mailinglist for PHP, PHP6 will most likely have Namespaces

PHP sucks for experienced programmers because they need to work harder to insure good coding practices. PHP sucks for beginner programmers because it lets them get away with ugly code.

It doesn't matter that PHP sucks for experienced programmers because they can still write clean, reusable, and readable code on an enterprise scale. For beginner programmers, it doesn't matter that PHP sucks because it allows them to do something useful with a powerful language -- one that they can grow into over time.

Raam Dev on May 22, 2008 9:04 AM

@Jasmine and manu

She's right though - I doubt most of these rants read past the first few lines of the post. People are so sensitive, especially about these stupid things like "do people think my programming language sucks?" - WHO CARES!

HB on May 22, 2008 9:24 AM

who the hell asked to use PHP? go fuck around with java / c or any other fuc-kin language. dickheads like you are just to spread flame and elitism, mother fuc-ker dumbass.

Necromancer on May 22, 2008 9:24 AM

wow, Necromancer. You sound like one of those people that got screwed in 1999 because they couldn't get paid $100k to do HTML anymore. Then one day, you saw a copy of OMGFTW pHp in 42 minutes at the local book store and therein saw your salvation. A ray of hope illuminated your soul upon reading that book, as you found a way to once again charge for cobbled together spaghetti?

Anon-E-Mouse on May 22, 2008 9:46 AM

You can't say a language SUCKS based on this criteria, when other languages SUCK far worse. C++ sucks because it's a pain in the ass to use. PHP is not a pain in the ass to use. Sure the library is an inconsistent mess. The library is not the language. I can get things done FAST and maintain existing things FAST, in PHP. THAT is what matters.

regis on May 22, 2008 10:12 AM

Many folks have used the argument that elegant code can be written in almost any language. That is true, for the most part. But that is not the point of Jeff's post, I don't think. The point is that PHP is a tool that is widely used, but is also inferior to the languages that were developed with large scale, extensible development in mind. To say that PHP is as powerful/useful as C++/Java/C# is like saying a carving knife is as useful as a power saw when building a house. The tools do matter.

Art on May 22, 2008 10:16 AM

Using rubyonrails makes my penis bigger

Bob on May 22, 2008 10:35 AM

Whatever else you might say about it, PHP's documentation is the best I've seen for any web development tool. That's a major reason I believe it has gained popularity. It's easy to make fun of "script kiddies" until you remember we all started as one. PHP, for whatever reason, is very intuitive.

I have developed a few quick apps using Rails and Django, and those are certainly not without faults. (Django can't alter tables if you change your model specs, defeating the purpose of designing them before your DB's). CakePHP is essentially Rails with code that's less "beautiful" (read: obtuse), and PHP nearly always runs faster than Ruby.

Brade on May 22, 2008 10:49 AM

I got a link to a blog post on this site. Read it, read a few more, and loved it. So I type up the address, preparing myself to stamp it on my favorites list.

First thing I see: "PHP SUCKS". Since I use PHP a lot, and I love it's features and simplicity, it didn't exactly ring a bell. Ok... I know people have different opinions, so maybe there's some interesting arguments in there. Right?

Well, where are they? All it says is PHP sucks, PHP sucks more than BASIC, PHP sucks real hard, PHP has all those functions that begin with the letter 'a' so it MUST suck!...

Never returning to this site again. This site sucks, but it doesn't matter.

CrazyBomber on May 22, 2008 10:54 AM

Endless discussions about style, people tend to forget PHP/.NET or whatever are Tools for you to create something, does not matter what your tool looks like, what matters is how helpfull it is, and the answer for this question is pretty clear: PHP is the most usefull tool for web creativity.

In my opinion, php has 2 major drawbacks:
- not thread safe with all extensions, this one is really bad
- native unicode support (should be here in V6)

"Le reste n'est que littrature..."

gaouzief on May 22, 2008 11:01 AM

I've written in tons of languages over the years including VB (I used to like but have moved from it because it's way too rigid and not portable). For most my work, which involves creating custom applications running on various UNIX platforms, I've settled with Tcl/Tk and C/C++. Tcl is great for rapid prototyping and even for powerful portable applications. Recently, I decided to port a web server written in Tcl/Tk to something more standard. So I moved to PHP. I must say it was the smoothest port coding exercise I had every done. Yeah for PHP!
I'm of the opinion that the language doesn't matter - it is the resources and community around it that matters. PHP allows you to do tons of stuff with little effort. Its flexibility and stability is hard to match.

Great blog by the way.

Martin Drapeau on May 22, 2008 11:03 AM

i sincerely hope you wrote this post to provoke argument, and not because you really believe it, otherwise, you're on the point of losing a reader.

i have been working for a major telecoms company for the past year. we're building serious, mission critical stuff. when i started, they had just released version 1 - written in php. it was intended to be a stop-gap until the 'real' application, written in c++, was deployed. the c++ has yet to be seen - it was eventually abandoned after months of delay. the one module that does exist was delivered late, wasn't properly tested, and has so far been the cause of two serious bugs in production. by contrast there have been no significant bugs found in the php code.

the php team has continued to consistently produce bug-free, high performance code, on time. it is now at version 2.3 and holding the fort just fine. take it as evidence that php is more than capable of handling serious applications. as for the c++, the effort has resumed to replicate the php functionality (for performance reasons). so far, despite having twice as many developers working for twice as long, the scheduled june date has already been pushed back. nevertheless i don't think c++ is a crap language, or the guys are poor developers. they've got a difficult job and they're doing the best they can.

jeff, i am totally fed up with hearing from people like you, how crap php is. you clearly don't know what you're talking about. you REALLY make yourself look stupid with comments like "OO, N-Tier, exception handling, domain modeling, refactoring and unit testing are all foreign concepts in the PHP world.". i have lost an enormous amount of respect for you because of this post. isn't it time you did your groundwork, grew up a bit and evolved out of the childish 'my language is better than yours' bickering?

phpdev on May 22, 2008 11:05 AM

If you haven't tried ColdFusion 8 - I highly recommend you take a look because after years of developing in everything from VB to PHP, aside from Ruby, I have found ColdFusion a shear joy to develop in while being extremely productive.

Ed on May 22, 2008 11:08 AM

The PHP Manual documents optional extensions too, like APC.

Not often have I heard people complain about too much documentation in the world... but each to their own.

Philip Olson on May 22, 2008 11:55 AM

PHP appears to be the defacto "do-it-yourself" server-side web dev platform.

Just look at the multitude of cookie-cutter PHP apps/scripts out there. Every low scale niche message board I go to, every bittorrent tracker website, all written in PHP.

Don't get me wrong, there are some very good open source ASP.NET apps out there for handling all the great generic problems. It's just that ASP.NET seems too industrial a platform for start up web developers lookin' to implement their grassroots ideas and host them for cheap.

Matias Nino on May 22, 2008 11:56 AM

My only beef with PHP is I can't do things like spawn threads or have variables that outlive the web call. I would kind of like to use nonserializable objects in sessions. Is that too much to ask?

In case it's not obvious, I only want the first two because if I have them I can make the last one for myself. Trust me, it really comes in handy.

Joshua on May 22, 2008 12:17 PM

@CrazyBomber

Did you even bother to read the links he's referencing? Those links are the shortcomings Jeff is talking about.

When you get right down to it, either spoken or computer all languages suck. They are all an 80% solution to convey what is going on in the mind of the person using the language. They key is overcoming their short comings and being successful in spite of them. PHP does this very well, so does VB.NET, C# etc in the hands of someone who knows the language well. It's a pedantic argument to say one is better...

Everyone who is all in a flutter because a blogger (with a penchant for hyperbole) who isn't a hardcore PHP says your favorite language sucks should go look up the word hyperbole.

Ryan C Smith on May 22, 2008 12:24 PM

>I'm just trying to be honest about my deep misgivings with the PHP language. It has some rather severe architectural problems, more so than any other language I can think of.

Hmmm... can you list anything of note that you've ever built from PHP, or are you simply parrotting the work of others because you had a slow day and couldn't come up with an original idea?

GregoryD on May 22, 2008 1:48 PM

You know what else sucks: just about everything!

It's just the way it is. Things suck so that when something comes along that actually doesn't suck, it makes it that much better.

P.S. Things that don't suck:
A cold Coca-Cola on a hot day
Swimsuit models (looking at them, not necessarily talking to them!)


kenneth on May 22, 2008 2:16 PM

@Jeff:

Here is the thing, man. PHP doesn't suck. It just started as non-OO and later became OO. That's like critisizing C++ because people code C++ and use a C function library when they could be using an OO library.

The shitload of functions is inconsistent and not separated into OO, because PHP was supposed to be backward compatible. Sure, it started as a hobbyist language (actually it started as a scripting language by Rasmus Lerdorf) but it did exceedingly well to become a major programming language. It is on par with C++ and C# in its expressiveness, and often exceeds it.

As for people writing unmaintainable nightmare code in PHP... I guess C# sucks for the same reason, as does C++ and C. Perhaps no one should use these languages. Just because a language doesn't force you to use OO concepts does not mean it sucks.

There are so many frameworks out there. Some are better than Rails for Ruby. Why don't you use one of them before writing a post about PHP? :)

Greg

p.s. By the way guys, here's a PHP framework if you want to do AGILE php development. I wrote and am currently maintaining it. SHAMELESS PLUG!! :)

http://code.google.com/p/pal-framework

Greg Magarshak on May 22, 2008 2:53 PM

("
I'm just trying to be honest about my deep misgivings with the PHP language. It has some rather severe architectural problems, more so than any other language I can think of. Even my beloved, much-maligned BASIC.
")

Come on. BASIC is much worse than PHP :)

Greg Magarshak on May 22, 2008 2:57 PM

> But I'm also here to tell you that doesn't matter.

Only if the amount of time you get to spend at home with your family also doesn't matter.

T.E.D. on May 22, 2008 3:04 PM

I love how everyone gets pissy when you insult the language they happen to use. Hey, guess what, learn a few more languages and then you come to realize they all have weaknesses.

Your assessment of PHP reminds me an awful lot of Python - a slapped-together standard library that is wildly inconsistent but nobody seems to say anything because its OSS and that makes up for it. Or something. Its a shame, Python as a language is pretty elegant for the most part.

I rather enjoy these shaming posts. Hopefully there are some subset of developers that will realize that a big ball of mud is not acceptable as an architecture - regardless of perceived time constraints. Engineers make software that is robust, hack-jobs write things that "should work" and simply hope for the best.

Matt Green on May 22, 2008 3:50 PM

I completely agree. I love php because it was my first web programming language, but as the years have passed and ive grown wiser, ive learned that its not the best constructed language. Its not even close. Actually its on the opposite end of approaching the worst...

Anyway, i agree with what you said, some of my best work has been in that crappy language so its not the language that makes the app great, its the person behind it.

Adam on May 22, 2008 4:03 PM

Obvious troll is obvious..

PHP is just fine, if you can get past the inconsistent function naming conventions. Familiar C/C++ syntax combined with a loosely typed scripting language that's supported by 99.9% of web hosts out there.. what's not to like?

mike on May 22, 2008 4:39 PM

Yes.

PHP is Awful and programmers who went to college and obtained their masters in Computer Science should not spend any time touching this highly profitable brainless format of web scripting language. You should instead contact your employers and tell them what you really think of their ineptitude in regards to choosing PHP as a solution and reaffirm your superiority over essentially everyone.

However, I for one - welcome our new PHP overlords.

And the money to be made doing it.

Zack on May 22, 2008 4:41 PM

"It is on par with C++ and C# in its expressiveness, and often exceeds it."

Talk about damning with faint praise....

J Thomas on May 22, 2008 4:50 PM

Wow. After reading all of these sterling posts from the defenders of PHP, I've decided to become an elitist code everything in Haskell. (that is, at least until I get my AI up and running - implemented in Lisp, of course - and then I'll just have it write Haskell code for me)

Plebes.

Lambda Hendricks Ross on May 22, 2008 7:57 PM

Yahoo! Bookmarks is also created using PHP - PHP5 that is, utilizing the Symfony. The latest gossip was that Yahoo! was re-writing Del.icio.us in the fashion too.

And Flickr -- initially it was done on PHP4 ;) I'm not sure what's the current state of the project, and if they "evolved" it to the more mature PHP5, but hey - even PHP4 was OK for building a heavy-duty tons-of-load website.

Kaloyan K. Tsvetkov on May 22, 2008 11:09 PM

Sorry Jeff, I don't understand the weight to your argument on this one. You seem to imply PHP is a bad language because of its size. I don't think this justifies a bad language. Sure allot of functions can be intimidating to a new user, but I don't think anyone sane would learn a language by reading the entire PHP API documentation.

Learning PHP is very easy because of its freedom in-terms of coding styles and numerous ways of doing things. The language itself has a kind of neutral syntax whether you come from a C++, Java or Perl background the PHP language is very well designed on the whole and allows the developer to concentrate on the task ahead rather then the implementation.

I’m sure that most of use turn to Google in search of an answer every now and then, and with php.net extensive API we are almost guaranteed to find, a workable solution with code examples in seconds – no installs or strings attached.

This comes back to the balance of between reinventing the wheel/developer time and a bloated API, in my opinion with the current popularity of PHP and the countless uses it has been used for, they have got it just right.

Shane Kelly on May 23, 2008 3:49 AM

ASP communities are indeed stuffed with professionals, but why? An ASP developer is mostly backed up by an employer that cough up the dough for licensing fees, training sessions, etc. In order to get started with a dev & prod environment, you already need a nice deposit to kick things off if you're taking the ASP way.

PHP (and from a larger perspective LAMP) requires almost no cash to set up a development & production environment, and gives starters / startups the opportunity to take their first webdev steps in an inexpensive fashion. And when relying on proven frameworks & libraries such as ZF, Qcodo, Smarty, etc. & holding on to common design patterns, the outcome of a PHP-backed project can just be as qualitative as an ASP project.

Shahways Romani on May 23, 2008 5:07 AM

I've seen some BAD C# code as well as BAD PHP.

I would agree with the comment that most PHP examples are written by "scriptkids". I write in C# on a professional basis, but honestly, I enjoy sitting down and working on my own stuff in PHP because it does that job and it does it well. As far as I can say, it is the guy typing in the code that makes the language look bad. I write in PHP, I know what I need and I don't add what I don't. If the programmer writes it readable the first time, then it'll be easy for the next guy to change later.

MikeF on May 23, 2008 5:20 AM

All this PHP sucks or doesn't suck is immaterial. At the end of the day, PHP is a tool. All tools have strengths and weaknesses. PHP's strength is in the development of web applications. It can be used for other jobs but web apps are its mainstay.

As for some of the things mentioned above (e.g. register globals, naming conventions), these, or similar, issues are found in almost all programming languages. It depends who designed the language and who developed the libraries.

Like other tools, they are only as good (or bad) as the tradesman who wields them. "Scriptkids" tend to write bad code because they have not been taught how to write good code. Software Engineers tend to write clean, readable code because they have been trained to. You could say the same about any programming language.

Another point of note, this seems to be a cyclic argument. I remember when I was first learning C at college over 20 years ago, everyone was commenting on the unreadability of C (many called it "Martian"). With proper coding practices, C code can be very readable.

NeilM on May 23, 2008 7:04 AM

Maybe the answer is that all of that whiz-bang meta-programming with 17 abstracting interface layers between you and the executing code is just another way to show off with no real reason for it.

Sooner or later, real programmers need to "inline some assembly code".

I can't think of a single framework that doesn't have a significant portion of it's users saying "It's perfect, buuuuut...." And they all have different problems.

Chris Chubb on May 23, 2008 7:35 AM

The fault here is not the language but the individual using it. If languages were used properly, the way they were supposed to be used then no one would complain about them. Most PHP samples written in php.net are great. So I don't understand what are you people talking about. Unless you are talking about samples written all over the web that are written by people that have no real programming concepts. I'm sorry but the first programming language an individual should learns should be ASM, nothing higher than that. People learning php, javascript and all this other language first are missing a lot. And these are the people that are producing a lot of crap and giving programming languages a bad name.

ElLo on May 23, 2008 8:09 AM

By what you wrote you could say the same thing about QBasic. QBasic is a terrible language. a hammer is a terrible language. Its a tool like everything else - it has a purpose (or several little purposes) which its very good at and its makes it popular. Its good at what it is, for how ever long. As good as java is if it wasn't for the money behind it - no body but its core audience would ever use it. Its a gun vs knife arguement.

owen on May 23, 2008 9:15 AM

You haven't mentioned that Yahoo Answers! is build with php5 + symfony framework, one of the biggest web application con the net.
http://en.oreilly.com/webexsf2008/public/schedule/detail/2368

I agree php by itself is quite a mess, but if you check symfony framework and its beautifull way of doing things you'll se how an application can be build with "high standars" so it would be easy, for example, to maintain the application.

finally and of course the main discussion is Php, not symfony (what I love), so yeah it does not matter!

neonard0 on May 23, 2008 9:20 AM

You haven't mentioned that Yahoo Answers! is build with php5 + symfony framework, one of the biggest web application con the net.
http://en.oreilly.com/webexsf2008/public/schedule/detail/2368

I agree php by itself is quite a mess, but if you check symfony framework and its beautifull way of doing things you'll se how an application can be build with "high standars" so it would be easy, for example, to maintain the application.

finally and of course the main discussion is Php, not symfony (what I love), so yeah it does not matter!

neonard0 on May 23, 2008 9:21 AM

<snip>
......but I also know it is not hard to right elegant, beautiful solutions.
</snip>

Elegant is mentioned obout thirty times in these comments.

It must be the write thing to consider ;-)

Bill on May 23, 2008 10:33 AM

Jeff,

I know it's all a tongue in the cheek to you. I'm afraid you aren't half aware of what PHP can do. Which is a pitty.

Your post made me realize one thing though; this blog is the wrong crowd for me. I won't be around anymore. One stab to many I guess..

JW on May 23, 2008 12:25 PM

There's way too many people here blaming the users of a language for its shortcomings. That's just plain dumb. The language is poorly designed...period. The fact that it is *possible* to write reasonably good code in it is no mitigation whatsoever.

David Platt's (http://www.whysoftwaresucks.com/) first law is that logistics triumphs over all. That is to say that things that are easy to do will get done and done often, regardless of whether they are "good" or "bad", simply because they are easy to do. The converse is also true. Things that are hard to do will not get done or get done seldom, regardless of whether they are "good" or "bad", simply because they are hard to do.

Therefore, the primary goal of *any* design has to be to make good things easy and bad things hard.

It sounds like the kind of common sense a child could come up with but do you see any of that in PHP ? It's one of the worst cases of "design by committee" (http://en.wikipedia.org/wiki/Design_by_committee) I have ever seen.

BC on May 23, 2008 2:51 PM

I've worked on some beastly php and perl scripts in the past. I've been asked to debug these bizarre php scripts where some moron pieced together "Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML."

That said, I doubt it's PHP's fault.

john on May 23, 2008 3:57 PM

>>Therefore, the primary goal of *any* design has to be to make good things easy and bad things hard.

The first thing I learned when studying PHP was to disable dangerous options which munge the global namespace with user input, magic quoting, etc. I did it not because I was a PHP expert (I was just starting to learn), but because all the PHP documents I read on the web hammered this point home.

Besides, the primary goal of a language should be to make a programmer's job of *easily* creating code which is bug free, maintainable, and fast to write. PHP does a reasonable job at this.

Bill K. on May 23, 2008 7:17 PM

Well I think that ASP sucks.

Jeff Atwoode on May 23, 2008 10:21 PM

php wins because of its easy deployment model.

every other platform, be it perl/mod_perl, python/mod_python, asp, asp.net, etc. requires a lot of extra configuration and likely some administrative access. imagine the instructions for installing a mod_perl version of WordPress.

if php is installed, it's got everything all at once.

choy on May 24, 2008 1:50 AM

Php's naming conventions never bothered me before.
And since I've switched to an editor with php auto-completion they probably will never bother me.

bubbles on May 24, 2008 2:16 AM

I love php too, holy crap, there is a lot of comments about this. My opinion after 3 years php programming, I started C++ and it's HELL.

Damn memory allocation, structures, objects are really make me hate it. I could write the exact same cli tool in php in 30 minutes what I can write currently in C++ under days.

PHP is a good language for newcomers, as my friend told me noone - or only a few people - gets to a good level in C++ nowadays but in the meantime a lot of people willing to learn php because it's E A S Y.

And I think this is the most important thing about programming languages, to made them more and more easier.
Like I tried to learn python 2 years ago and I quickly gave it up simply because of the spaces and tabs which annoyed me. Why would I waste time to learn it when I already have experience in perl.

So guess it's just a point of view that php is sucks or not...

dod on May 24, 2008 2:26 AM

I will never understand why a language has to be so completely technical and complicated that only programmers with 20 years of experience or those who work with assembly language for fun can understand them before it can be considered legitmate. All programming languages suffer from either being too restrictive/complex that it's audience is rather limited or so broad and extensible that suddenly everyone is a programmer. To be honest, I'd rather have the latter. You may get a lot of bad code practice and a messy code, but at least there is a sense that the language was developed for human beings and not an elitist band of bit worshipers. So I say hail PHP, thanks for making web programming a reality for anyone who is willing to learn how to code the way they shouldn't.

Xav on May 24, 2008 6:19 AM

IMO the problem with PHP is that every book on learning it doesn't teach any best practices, but instead shows how to hack together spaghetti code. I have yet to find a good PHP book that showed how to make use of MVC, how to use abstraction layers and/or ORMs to avoid having to write both logic and presentation in the same page.

I tried in vain for many months to learn PHP, and couldn't make any headway because it was all spaghetti-code garbage and textbook worst practices. Then I found Ruby on Rails and am much happier.

Wayne on May 24, 2008 7:19 AM

Reading this Posts, i come to the conclusion, that PHP (or any langauge, i guess) is mainly still in use, because enough people _believe_ that it is good.
The fact if something acutally IS good seems to be irrelevant, because if one does not fail completely, that is taken as a proof for the goodness ("its the bad programmers", yeah, as we all know, those are allways the other guys).

It is interesting how many unprovable, generic statements are made:

"it gets the job done" what should that mean? that it is touring complete? that it is not completely impossible finish your task? how would a language look which doesnt get the job done?

"it is possible to write bad code in any language" yeah, lets program in assembler, brainfuck or malbolge, since languages dont matter. Just because it is not easy to measure, it doest mean its irrelevant.

but, i fear that exactly these stupid statements are those which are uttered by the ones, that decide what language to use, and because of their prejudices (which i guess they call "common sense" or "instinct") the productivity of another bunch of coders is invested in "beating the language" rather than in creating a great program

keppla on May 24, 2008 7:20 AM

My main point for arguing that PHP sucks would be:

It has spoiled me. Possibly for good, I might add.

Nowadays, whenever I'm trying to learn a new language I find myself looking for near-PHP quality documentation. Online or offline. I'm amazed how many different languages (and libraries, and programs, what not) fail to come up with such good documentation.

I don't need tutorials (not after I've learned the syntax). I don't need example code, I don't need anyone to "write me a script to do X". I need good solid documentation, where I can read what parameters a function takes and what it does with those parameters, and what it does when I happen to give it illegal ones.

I want to know what the language offers me in terms of, say "String functions". Moreover, I don't want to read documentation written by people who think I mean "String members" when I say "String functions".

I've recently started working 'sparsely' on a hobby Python project. I got more or less over the whitespace-sensitivity thing though I didn't think I could do it and I've even made peace with the fact that it's not really a programming language. (No post-2nd generation programming language should lack multiline comments) What I'm trying to deal with right now is the documentation, or more precisely, the lack of it. The whole online manual is presented like a thorough tutorial and I'm having one hell of a time trying to find information that should be at my fingertips, e.g. how to write module initialization code (to be executed once at import time) You can see how I'd like PHP's approach here, can't you?

Another thing is, PHP just _works_. Yes, it has a plethora of functions, but they work. As documented. After wrestling with ActionScript's arrays (which are also hashtables-in-disguise) I've come to appreciate simple things like being able to delete elements without calling splice() and array functions that don't require the array to be in a specific form (like 0-to-N numerically indexed without gaps). (Actually, PHP's ability to handle mixed arrays well deserves a whole paper of its own.)

aib on May 24, 2008 12:57 PM

If something is stupid, and it works, it's not stupid.

Mattkins on May 24, 2008 4:40 PM

Yahoo also has a large portion that has been developed in PHP.

Mark on May 25, 2008 7:51 PM

ASP is PISS backwars if you change the A to a S and put a I between P and S....

Jeff Atwood on May 25, 2008 7:54 PM

Jeff,

You wrote 4 times "PHP sucks", but you just didn't explain why.

In fact, that's just you opinion. You don't like php so php sucks.

As an argument, you show an impressive list of function beginning with the letter "A".

Don't you know about keyword search ?

When I need to do something new in php, I think "I'm sure there is a simple way to do that". Then I do some keywords searches in the online documentation, then I find the way.

Moreover, in your list there is 48 functions dealing with arrays. I say that all of them are useful an efficient, depending of the context.

anomail on May 26, 2008 4:36 AM

Jeff,

An error occurred:

Rebuild failed: Renaming tempfile 'C:\codinghorror\blog\archives\001119.html.new' failed: Renaming 'C:\codinghorror\blog\archives\001119.html.new' to 'C:\codinghorror\blog\archives\001119.html' failed: Permission denied


I don't know what language you used to write you blog, but it sucks !!!

anomail on May 26, 2008 4:37 AM

Nicely structured and designed code can be easily written in PHP - our company does it every day. We have many experienced PHP programmers, and I would say crap comes not from language but from programmers - it's only a matter of who is programming. And btw - PHP just works, out of the box.

Olavi on May 26, 2008 6:42 AM

There's no need to take this blog personally ya know, PHP does have a lot of bad points, but it also rocks. I think it's good to bring its flaws to light, maybe the php devs will take notice.

spemless on May 26, 2008 7:33 AM

I don't care about the differences betweeen languages - as long as the output is correct. In that respect all languages used on the web today are equal. Their output sucks.

W3C Validator says about your page: Validation failed - 88 errors.

Those who understand DTDs build clean websites - the others use web-apps.

Bernhard on May 26, 2008 8:00 AM

Great post Jeff. While I don't mind PHP as a whole, the function-oriented nature of it does tend to drive me nuts (exacerbated by the terrible and inconsistent naming scheme). When going from C# to PHP I certainly miss the former's OO design.

And Ha Ha @Bernhard! When did validator errors come into play? OMG you forgot the ALT attribute on your images. ASPX SUCKS! In any case "valid output" is in the eye of the beholder.

Nick on May 26, 2008 12:08 PM

Wow! Let's try to summarise some of the BRILIANT counter arguments here shall we :

1) "Lots of other languages suck too including ones you might like or use"...thanks to the PHP Brain Trust for this one. We can see how this completely proves that PHP doesn't...right ?

2) "Jeff sucks" etc...how many times do you need to be told ? You are not your code ! You are not your choice of technology ! People should be able question your technology without you taking it personally and resorting to childish personal insults. They are the last resort of the total retard and apparently the FIRST resort of the PHP programmer :)

3) "PHP works"...REALLY ?! That MUST mean it doesn't suck, surely ? Because there's NEVER been ANYTHING that both worked AND sucked, right ?

4) "Lots of people use PHP, even grown ups...I mean big web sites"...yup, there you go again with your incontrovertible proof because NOTHING that sucked could EVER be popular...right ?

BC on May 26, 2008 12:16 PM

hi, standard or CLI php does not have Hundreds of functions with Substring 'A', 0, 1 ;)

and can be cool like ruby:

http://codesnipers.com/?q=php-can-be-cool-like-ruby

via: http://reinholdweber.com/?p=6

p on May 26, 2008 1:31 PM

As I read your article and your conclusion

"The only conclusion I can draw is that building a compelling application is far more important than choice of language."

I also had my thoughts about it. Well I can't speak in general terms here but what I experienced during my days when I was a developer trainee was that there have been a lot of people who have chosen PHP by simply not knowing better. For a beginner PHP looks easier than - let's say C#. Once stepped on that way it's hard to leave it for a better one. Furthermore there are many poeple out there who refuse everything which is labled "made by Microsoft".

Rainer Hilmer on May 27, 2008 1:48 AM

The comments here are extremely disheartening. PHP is good because it can do anything? Welcome to programming languages; anything that's Turing-complete and supports C bindings fits this definition. PHP is good because it's light, free, fast? Perl, Python, Ruby, and others. PHP is good because.. well, that's about all I see, really.

Have most of these commenters even used a language besides PHP? The general feeling I'm getting here is that a lot of people learned to use a hammer (well, a playskool squeaky hammer), discovered that most problems roughly resemble nails if you squint hard enough, and concluded that their hammer is the best tool ever.

Nobody has ever provided me with a single advantage PHP has over raw Perl/Python/Ruby with their respective CGI libraries. They all give instant feedback. They're all about equally fast (well, wait for Ruby 2). They can all "do anything", whatever that means. They have a decent install base (Perl even moreso than PHP), but even if you don't have your own server, finding a host who can run what you want isn't hard. If you really really want to, they'll all even let you embed code directly in HTML. The difference is that PHP was cobbled together, whereas the others were actually designed.

It may be possible for a good programmer to write good code in any language, but there's no reason a good programmer should have to waste the time and effort working around the language to do so, and I'm willing to bet the same programmer writing the same code in a better language would do it better.

Eevee on May 27, 2008 6:18 PM

For anyone else who disagrees with Jeff:
http://frankkoehl.com/2008/05/27/php-does-not-suck-and-heres-why/

Frank on May 27, 2008 8:42 PM

I code in PHP, Delphi, ASP & ASP.NET (C#) on a daily basis. I have no loyality to any company, product or language beyond how much I enjoy writing in it and how well it lets me express intent.

I won't say I like writing PHP but it's power comes from a single, obvious fact: you can move from static HTML to dynamic PHP in a few lines of code. Maybe it won't be sexy code, maybe the whole application won't be structured to perfection but even $5/month hosting accounts usually have PHP support.

Contrast that with moving from static to ASP.NET and it's no contest. A dirty little secret is that a lot of "web developers" are actually web designers that have been pressed into dynamic site creation and PHP is a much easier and less technical transition. As a pure nerd I much prefer the more developer-centric ASP.NET but it shouldn't be a secret why PHP powers so much of the web, because it's easy.

Shawn Oster on May 28, 2008 12:08 PM

Oh please.

What exactly are you trying to show by listing all PHP functions that start with 'a'? Unless you've worked with MATLAB you have no license to complain. Using your little coding-pussy metric, PHP has a 134 and MATLAB has over 800; MATLAB has only pass-by-value (except in >R2008a when inheriting from 'handle'); it also has a programming culture that purposely tries to make their programs as terse as possible in order to 'vectorize'. Despite these drawbacks, there isn't a better environment for prototyping algorithms and numeric code. Why should I have to worry about IAbstractComplexBlockOperator.InnerRankException when I just want to see if the Ritz values converge?

On the plus-side, I've gotten somewhat decent at linear algebra.

Matlab User on May 28, 2008 9:49 PM

I work with ASP & PHP and I prefer PHP. It's more flexible and powerfull. You can't make a judgement of a language looking at the command list, because you don't need all commands to work with.

Gu on May 29, 2008 9:24 AM

hahah "do you live in a rock this 5 years?" is all i need to say.. PHP is amazing and very powerfull, and FREE, remember that? go and buy a windows vista...

duckman on May 29, 2008 10:24 AM

if you think PHP sucks, try using JSP/Struts. You will go back to PHP with flowers in your hand.

kolimator on May 29, 2008 10:34 AM

The fact that you're using PHP as a beginner doesn't mean that it sucks.

The beauty of PHP is that it doesn't come with a framework built in it, instead you have to grab (or even better: develop!) a framework that fits your needs and use it.

The difference with (let's say...) .net is that this one comes with a built-in framework.

I write PHP websites/apps without calling ANY function of those mentioned in the list you posted. You should check some framework and try developing apps with them (I suggest: Codeigniter), then your code will look elegant, neat, and it will be much easier for you to do the stuff you need without a big effort.

Regards.

Cris on May 29, 2008 1:33 PM

You do realize that 90% of those poorly named functions were in fact ported from the language C/C++ ? The same language upon which the most critical systems run. So I wouldn't say that C sucks nor PHP

Q on May 30, 2008 1:53 PM

Personally I use PHP a lot for web-based applications. I was an application and systems developer for many years before I started my foray into web-based applications. Going from C/C++ to PHP was a culture shock that drove me to drink. (Just kidding, but barely.) I was so appalled that at first I actually opted for writing CGI applications in C++.

But now I wouldn't say it's a terrible language. As has been pointed out, PHP was really made just for the web and in a lot of cases when developing a web app it is much easier and faster to do it in PHP than any of the more elegant languages. From a standpoint of programming language elegance and continuity I would have to agree that it sucks, but from a standpoint of usability, utility and availability it is great. And I think the latter far outweighs the former in "most" cases.

Granted, if you're going to develop a complicated large-scale web application where you have control over the hardware, you're probably better off going with something like a Java-or-.NET-based solution. For just about every other web application you wouldn't go wrong by at least considering PHP.

Though I would have to take some exception with those that draw the distinction between PHP the "language" and PHP the "API". If you take away the API, then PHP really really really sucks because you wouldn't be able to do anything with it. None of the API is actually written in PHP and trying to roll your own in PHP in most cases would be impossible and in other cases would merely suck very very badly.

Best Regards,
Gerald

Gerald on June 1, 2008 1:20 AM

Grab a framework my friend... try CakePHP for a start. And then you will realize how interesting and flexible PHP actually is..

Zahasman on June 1, 2008 4:57 AM

My PHP coding is rubbish - but it seems to work. I've even written some small applications that work. I can't afford to go on an .net course and I've found everyone I've ever asked in the forums etc has pointed me in the right direction. there again when I did IT @ uni I did have a tutor who took marks off me as he couldn't understand why my application worked - even though it fulfilled the brief...

Michael on June 3, 2008 9:08 AM

Although the PHP code might not be too organised, the main reason for "rubbish code" are "rubbish programmers". Too many people buy a book (or read an online tutorial) and start coding in PHP with no other knowledge in programming.

I learnt PHP by reading the online documentation, but I had prior (theoretical) knowledge and experience in other languages like Pascal, C, C++, Basic, VisualBasic, and Java.

I remember missing in PHP many features from C++ (which I like), and it is true that PHP doesn't *force* you to write properly like C++ might do (in some way), but it certainly is up to the programmer to code properly or not.

It really makes my blood boil when people call themselves web developers because they bought a book on Dreamweaver.

jjq on June 3, 2008 12:19 PM

I definitely agree with the blogger. PHP doesn't really sucks..It depends on the coder. If the coder is really incompetent then any language not only PHP may suck and keep complaining on it but if the coder is really good then programming language is not an issue. A really competent coder can even write an amazing application written in old languages such as C or Turbo Pascal or even assembly language.

Allan on June 3, 2008 7:07 PM

will we ever stop complaining? every language has its shortcomings - ruby is too slow, perl is too complex, php is to insecure, c is too low level. there are no shortage of criticism for c++, python and java as well. if you think something sucks, why don't you make it better?

chris on June 6, 2008 4:16 AM

While I agree PHP has some function bloat, I wouldn't go so far as to say that it sucks because the alternatives aren't much better. I'm also a veteran Visual Basic programmer. I learned ASP because I already knew VB, though the lack of decent documentation was a challenge. I developed web sites in classic ASP for eight years.

I would choose PHP for any new project without hesitation. There's certain things which PHP can do that seem near impossible in ASP. Want to upload a file in ASP? Need to buy a plugin. Want mod_rewrite functionality? Need to buy a plugin.

I haven't touched ASP.NET yet. I read a book about it a few years ago and all it seemed to be was more bloated than classic ASP. That might have been because the book was one of those crappy "Learn in 21 days" books. The push to create server controls for everything just doesn't feel kosher.

Scott on June 8, 2008 7:01 AM

Guess what made MS as big as it is today? MS-DOS, which was not very innovative and was in fact acquired from Seattle Computing Products, but it did not matter back in 1981, because their competitor (Digital Research) made a mistake.

Yuhong Bao on June 11, 2008 8:32 PM

for all the rants that are out there, valid or not as they may be, they don't help.

give alternatives, specific ones and include the reason why. sure, php sucks, but what should websites be using instead? why?

it's a very important piece left off of this great article (and many other ones).

i'm reminded of what churchill said about the U.S. once, paraphrasing here:
"It's the worst of all possible governments, except for everything else."

randy on June 23, 2008 3:24 PM

Enjoyed the rant, Jeff, and some of the responses too. I'm pretty new to PHP and as an experienced programmer (Java, C, Smalltalk, SQL, PL/SQL etc) I have to agree that PHP feels clunky, poorly structured and all the rest. But as several people have pointed out, it works and is widely used for very successful and heavily used websites. Which is basically what it was invented for. Sure, you can do the same thing - usually far more elegantly - with other languages, but so what?

PHP seems to have taken off for a number of reasons having nothing to do with "elegance" - ease of entry, easy web-oriented functionality, easy deployment, and so on. Personally, I like Smalltalk for OO programming, but most people are using Java (which to me looks like C++ with the stupid bits removed). And most of the PHP sites I visit seem to work better and faster than most of the JSP/Struts sites I visit.

Right now, I'm getting into Zend Framework 1.5, which looks like a good attempt to bring some order to the anarchy of PHP development, and illustrates the point that programming languages are just tools - it's how you use them and what you do with them that counts.

chrisw on June 26, 2008 3:19 AM

As this will appear below approximately 50 lbs of other comments, I'm going to go ahead and toss in my two cents. I've been using PHP for years for various projects, and I love it. I find it to be very intuitive and immensely easy to use.

I produced my fair share of crappy PHP as I was learning the language, but any real programmer can put PHP to good use and produce elegant code. I will admit that the language can have a superfluous number of functions, and their calls can be dissimilar, but whenever I'm developing for the web I always have a browser open. Hit a new tab, tab into the google search and type PHP array diff, and I'm back to coding in 10 seconds.

pat on June 29, 2008 1:27 AM

Ha,

This is so funny.

I'm a dot net programmer for the past few years, and find it great for large scale projects, with well structured teams and roles.

However, whenever I want to get a project done quickly, with little time, I regress to PHP code. It's just too good to be avoided.

jiminajam on July 7, 2008 3:28 AM

I see programming for the web as one of the hardest forms of programming. Every querystring/form variable could be a hacking attempt. Websites are constantly probed for holes. Electronic payment are wired into these systems, which bring with them legal and social responsiblities to work correctly.

Given the above setting for solving programming problems, why would one use a dynamically typed, uncompiled, risky, inconsistent programming language? When one requires the most rigor, reliability and provability, people turn to PHP which provides the least of these attributes of all the languages aforementioned.

PHP's allowing users to hack out code quickly is it's own worst enemy. When one hacks out code, one uses lessforethought, planning and design. This leads to the so frequently mentioned spaghetti code.

If programmers slowed down, learned to use the basics of rigorous languages like Java and C#, thought about code before hitting the IDE, maybe we wouldn't need PHP and the spaghetti drosh that it allows people to pump out. Compilers exist to verify code to some useful level. Why write code without one? (Client-side Javascript is exempt from this.)

O and roll on Haskell!

Rich

Rich on July 7, 2008 3:46 AM

Things like, for example, magic quotes (on the way out, thankfully)
I'll escape things when I damn well _want_ to, thank you very much. And I certainly won't do it before inserting things into a database - you shouldn't be teaching people to create SQL statements by string concatenation.

The vast inconsistency of function naming and return values - some array functions operate directly on the array passed, and some return a new array, for example

The _functionality_ of php is brilliant, but despite having more experience in php I find writing code harder than in python or asp, simply because the inconsistencies mean I can't take anything for granted

Frymaster on July 7, 2008 6:44 AM

@Matthijs

Perhaps the reason why the ASP community is more "professional" has something to do with the fact that you have to pay at least $60/yr just to be a member.

Today I was trying to figure out how to display an RSS 1.0 feed in DNN. Couldn't find any tutorials, did find a lot of people who wanted me to pay $20 for a solution.

Granted, if I was more familiar with the language, coding something myself wouldn't be a problem. But it seems like everyone in your "community" is more about making a quick buck and trashing the competition than it is about actually helping people to learn.

Say what you will about the relative merits of PHP, it's far closer to the classic conception of a programming language for the web than anything that's come out of redmond, and the neighbors are a lot more friendly.

Sam on July 9, 2008 11:57 PM

It seems that Ms Stob has taken a difference to your PHP analysis ... she quite likes it and understands that the pester_victim_with_stupid_emails() function was added last week... :-)

(More at
http://www.theregister.co.uk/2008/07/07/web20_for_developers/page3.html)

Chris J on July 11, 2008 3:16 PM

Well, if it sucks, then a more interesting phenomenon is - why, while there are less sucking alternatives, it has such a wide adoption?
Yes, the user doesn't care about what technology did you use. Yes, using a technology that sucks you can still make it work for the user, and you can write a good code. But! That would require some efforts just to overcome the badness of, say, PHP. Wouldn't those efforts be better spent elsewhere? Say, instead of "ok, now I am going to work some way around THAT annoying flaw of my technology" it would be "ok, now I am going to add that new cool feature for the user". So why the heck?...

Vladimir on July 13, 2008 10:14 PM

I have to agree with Vladimir. PHP makes my blood boil as to how horrible and inconsistent it is.
Here's a gem 'gotcha' I ran into a few weeks ago that left me scratching my head for at least an hour...

[megawidget@dammit /usr/home/megawidget]$ php -a
Interactive mode enabled

<?php
$xmlobj=new SimpleXMLElement('<xml>potato</xml>');
print $xmlobj=="potato";
1
print $xmlobj[0]=='p';


it prints nothing? OMGWTF?!!1!
I've figured out the problem since then, but it doesn't change the fact that the PHP libraries are sufficiently often either broken or inconsistent, that I spend a lot of my time coding around ridiculous flaws. Just the other day I had to work around the fact that PHP has the shitty crippled version of C semaphores w/o support for non-blocking acquire attempts, and I had to resort to using advisory file locks. So much for the "it's not the tools, it's the carpenter" argument, huh?
I could probably rant for at least a few hours about this, but oh my, look at the time... I'll just mention a few more WTFs that make me want to find the core PHP development team and dismember them using a rusty kitchen knife:
1) using an uninitialized variable is a NOTICE (not even a WARNING)
2) passing too few parameters to a function is a WARNING (not an ERROR?!?!?)
3) passing too many parameters to a function is apparently perfectly acceptable. THAT'll never cause any problems, I'm sure!

Igor K. on July 16, 2008 3:55 PM

php does not sucks, it has so many built in functions
:P

grinder on July 18, 2008 3:53 AM

I was quite amused to find the following item on the php keywords list:

"goto (PHP 6 only)"

Michael Renner on July 20, 2008 1:35 PM

I've been a programmer for a long time, and used pretty much everything from 8086 assembly to Unix C++, stopping by VB, VC++, ASP, and -- of course -- PHP.

I personally am a big fan of PHP. But I will agree that it sucks in a particular way: it will let bad code run fine. Just like ActionScript 2, that Adobe improved in AS3.

PHP is slowly doing the same, but is stuck with a lot of developpers writing -- and therefore code written -- in a bad way. Radically changing the compatibility and breaking legacy code would severely impact PHP's greatest strength: its community. So I understand why this is done bit by bit, and piece by piece.

The PHP5 OO model isn't perfect, but it supports Exceptions, and there are a few very good frameworks available out there. PHP6 will be better, and hopefully it'll keep improving.

Cheers,

Tommy Lacroix - www.tommylacroix.com

Tommy Lacroix on July 21, 2008 3:18 AM

I think php is perfect in website.You can easy to build a website in php.

bkkkd on August 25, 2008 5:59 AM

PHP is easy to learn - ergo it will attract programmers who have little or no proper training in the discipline of programming and program design (like the article's author for example). Visual Basic did this too back in the 80s and early 90s. Even accountants could write simple programs. This had the net effect of devaluing real programmers who are actually competent and properly trained professionals. It scared off many companies from investing in custom software because of all the horror stories that originated from people who have no business developing software giving everyone else a bad name. This is not the fault of the language, it is the fault of the cheap-ass people who do not understand the concept of "you get what you pay for".

Attacking a language because of poor coding style used by sloppy programmers is not really fair. That is like saying that all Hondas are terrible cars because some of the people that drive them are terrible drivers.

I have used many different languages over my 20+ years of programming for a living and I realy like PHP. You can get a lot done without writing lots of of code, it offers almost all of the features that I have ever needed, and it is pretty quick at running well-designed scripts.

The opening point made by this article is about the lamest I have read for a while. Who uses a function reference sorted by FIRST LETTER? The PHP reference is organized by function and I never have any trouble quickly finding what I want.

I also take exception to the statement

"If you sit down to program in PHP and have even an ounce of programming talent in your entire body, there's no possible way to draw any other conclusion. It's inescapable".

I like to think I have some programming talent. I have written programs that have procesed billions of dollars in transactions without a hitch. I know at least 10 different programming languges from PC assembler to VB.NET. I have scored top marks in computer science programs at well-respected schools. I don't think PHP sucks. If you have programming talent and some creativity, you find ways to get around the limitations of the platform you are using rather than saying "It sucks".

In my opinion PHP does not suck, but this article sure does. If you want to try a language that really sucks, try assembler.

dave the coder on September 8, 2008 12:25 PM

This is very interesting what I'm reading here, so many experts here maybe someone tell me:
1) how can I generate objects from XML Schema (xsd)?
2) is there any tool to generate WSDL from PHP objects?
3) what about Test Driven Development and Aspect Oriented Programming is there any solutions yet?

Szarka on September 12, 2008 5:07 AM

I don't have anything against Java, Python, Perl, Ruby.. but when i hear Php - wrrr..!!!

1. Why Php programmers don't use any programming standards?
2. Why they do not interested in any programming methodologies, testing or any new things. They only know Php syntax and don't want learn anything else for rest life
3. Php is so simple that when You ask Php programer to generate proper xml, then he need 5 month and probably you will never see your task resolved

.
.
.

Pseudo Language Discriminator on September 12, 2008 5:17 AM

You're wrong! A lot Php programmers go to .Net after about 10 years.

Php Follower on September 12, 2008 5:21 AM

@Pseudo Language Discriminator
you probably don't know PHP at all, maybe you aren't even programmer

PHP rocks!!!

William on September 12, 2008 5:28 AM

Developing websites in Php is fast because Php project needs 6-8 Php template writers, 4 database administrators, 4 administrators (because 200 servers, load balancers and failover systems) and 3 Java developers and 3 C++ programmers for preparing content that will be 90% of website.

Pseudo Language Discriminator on September 12, 2008 5:37 AM

Php isn't even real programming language but Html templating system with database interface

Pseudo Language Discriminator on September 12, 2008 5:41 AM

There is a direct parallel with the barrier of entry to a language and the amount of horrid code in that language.

But then again, there's a lot of bad code written in C for various reasons, one of which is the HIGH barrier to entry. (Another reason for bad code in C is that simple mistakes in C can lead to horrible mysterious bugs that take forever to track - integers setting themselves, memory leaks, etc.)

But if you're coding for the web, you have a limited number of options:

Java - JSP is hard to set up and not popular on shared hosting server, raising the barrier to entry.

ASP.NET - Requires Windows, popular on shared hosting, but more expensive both on shared hosting and in an enterprise setting. Also, I don't have experience with ASP.NET for the web, but I have the impression that if you want to write code by hand instead of using the designer, there are more hoops to jump through.

Ruby or Python - Both good, well designed languages in their own regards. Their Apache modules aren't as robust, and their documentation is nowhere near as good as PHP. Still, worth it if you can. Less popular on shared hosting, but it's often there. For example, lots of servers have Ruby, but getting gems installed might be a pain.

PHP - Monolithic set of functions for everything. Well documented. Provides most of the good OO features you want, but the (most of) core functions don't use those features. Everyone hosts it. It's easy to manipulate everything web related with it: XML, HTTP headers, Cookies, Sessions, curl requests, resizing images, handling form uploads, sending email, using a database, creating XML, etc. It's all there in the jumbled pile and it's documented well. Low barrier to entry, and lots of potential if you know what the hell you're doing.

So, while PHP sucks as a language, it wins on all the other criteria for choose a web language.

Jam on September 18, 2008 8:18 AM

The only problem with PHP is that it's far too easy to write BAD code. I've seen well-written PHP, and I've seen crap like what's behind Wordpress or OSCommerce.

If people would learn how to write proper code in the first place, instead of just typing out procedural nonsense that's insanely difficult to modify or extend, then PHP wouldn't "suck", it would just be ugly.

Wayne on September 19, 2008 10:18 AM

@Jam: but what about performance - PHP is still good in small website solutions, but when you need such things as db replication (Sequoia), transactions (JTA), clustering (Terracotta) - what offers PHP then: master-slave architecture on MySQL without any failover, transactions probably not, clustering as webservers as standalone nodes.
Lack of application server - how PHP can handle data for itself - in files or in database, what is always wrong solutions. What about caching which Gavin King from JBoss said is narrow throat of PHP? Is Smarty "caching" something like Java's Ehcache? - NOT AT ALL!
What about prices - how much would you pay for stability, failover, and performance in PHP a lot because you need to write all yourself (making DB backuped with cron scripts and other *nix bash code solutions) and in Java you have it free for now.
Server prices - there are free servers, paid servers starts from few bucks a month (look at godaddy).
What about schema guys? Don't have implementation for the most important thing in nowodays world?

Szarka on September 22, 2008 11:16 PM

jsp is the same shit like php (and the same ages) but there are a lot of new modern frameworks and technologies in Java that Php cannot compete with, even if Php have good frameworks too because Php is very bad language.

Today, Java has Wicket, Tapestry which are full object-oriented and forcing good design frameworks. Java has milion solutions more that Php and today Java has Javarebel - that enables to reload changes made to Java class files on-the-fly..

So Php die! Php developers can do simple pages for farmers and kids-rockstars :)

Pseudo Language Discriminator on September 22, 2008 11:21 PM

PHP not be elegant as other but it's a very good language to get ease done. moreover PHP is cheap. You just need have some discipline and knowledge.

iMan on September 29, 2008 3:05 PM

Yes, PHP is cheap as Chinese products are, but the potential cost of using Chinese products could be high (you can die from their milk, or get serious cancer using some of the plastics spoons :). Same is with PHP - you write fast, you loose high.
Remember young programmers: projects could be done fast, cheap, and good - now choose two of it. You choose fast & cheap, we use fast & good :)

real programmer on October 3, 2008 12:39 AM

One word: Python. I used PHP back in 2000 for a university department web site project and realized it's not elegant. It's a messy scripting language that's easy to pick up by anyone. Sites like Digg, Facebook aren't a great technical accomplishment and they follow the trend and pick the tool of seemingly least initial learning curve with no foresight about future scalability and maintenance. Which is why I picked Python and developed a whole web application framework for my next few projects. It's stable, fast and very re-usable. The code is easy to understand that even when I look back to the code I wrote in 2004 I still can quickly follow the logic.

Like most people in life, programmers are no different when it comes to pick a popular language that has a easy learning curve.

Lincoln on October 9, 2008 1:25 PM

I am a novice web designer that has designed quite afew websites using just notepad and html....I have found PHP a great help in certain situations eg. using the php include. Thoguht i'd just post that :)

Mikey on January 9, 2009 3:30 PM

The reason so many people use php is that it makes it easy to do pretty much anything. I mean, if you're using java/c# and want to parse xml, it takes you like a whole paragraph of code...something php can do in a single line. is that cool or what?
a language is not bad, its the coder who make a language look bad. you guys who diss php suck

Knowledge Chikuse on January 20, 2009 11:28 PM

What an awful blog entry. I've long wondered why people think this site is worth reading, and this article hardly sheds any light on that question.

Just because there's a lot of code that is poor in PHP, means nothing. A large number of functions that start with 'a' - OMG, WHAT WILL WE DO??

In reality, PHP is a fast, simple language that simply gets things done. You can use it to create web pages, and it is reliable. It's complete, simple, and effective, and also well integrated with Apache, therefore very easy to deploy. Saying 'it sucks' is pretty childish.

Jenny on January 23, 2009 12:55 PM

There are WAY too many comments here... Where's a good mod when you need one? Or at least some form of discussion threading?

Anyway, to poo on the same pile, I have a speculation I would like to add. Like mentioned in at least one comment flashing past my eyes in my fast-as-I-can speed-read-scroll-to-the-bottom, I think there's a GREAT difference between people who come from a true computing/programming background and learn certain forms and visions of logic apposed to those who do not. I guess that if you come from a more technical background the design flaws in PHP might make you cringe (or have nightmares or wet yourself... like any alcoholic beverage might). If you DO not, however, PHP really is the only viable choice to get started. It's just so easy and friendly and supported right down to the i-can't-even-spell-my-own-name-right idiot.

This is only a guess of course, but I reckon there's probably more folks who use PHP who are/were not tech-savvy. This means PHP wins, even in stupid arguments (like the one this comment thread is turning into), by sheer weight-of-users.

Does PHP suck? As everything, that depends ENTIRELY on the context the question is posed in. Does it matter whether or not it sucks? Probably not... like mentioned in the original post.
Does anyone care about these type of statements or discussions? Doubtful.

The only thing that does matter, like the original author stated, is the actual state of reality at this point in time.

PHP gets a job done quick and easily, is widely available and supported and (with the right set of programming skills) can achieve unimagined heights.

I for one feel PHP fits firmly in what we now call the internet and webdevelopment... I mean, think about it... Everything about the web, as a developer, has some degree as suckiness. Either the language, the implementation or the support suck for (X)HTML, XML, ECMA/Jscript/Javascript, CSS, et al.

All we can hope for is that, as all web related languages evolve, they start sucking less.

Fun write-up though ;-)

potherca on February 18, 2009 12:28 PM

Just because a language *has* 1000 functions doesn't mean you have to use them, or even know them.

zaphod on March 4, 2009 6:37 PM

Ok, let's address the real issue. PHP is a *SCRIPTING* language for a web server. When written correctly, it is no better or worse than any other language (I have been programming 16 hours a day for 20 years). But what it lends itself well to is the organization and reuse of code.

PERL handles it well, PHP does it just fine - ASP Classic... now you're starting to get into the MS idea that if you cram enough lines of code into something it will eventually work. .Net.... Not opposed to C# - I write programs in it. But let's be realistic - it's web enabled output is ASP warmed over. The code bloat that occurs when a site is published is usually substantial. And the ASPX postbacks are staggering. (Try this on a major using dial up - yeah, I maintain a modem just for these cases)

So let's review -- clean code written in any language is better than muddled code. However, I've put out 200+ average size sites and 50+ enterprise class sites in PHP. I'm going to say that if you know you how to program it usually isn't a problem.

But then again, I don't think that Microsoft invented the OS or the mouse LOL. And those of us who didn't start in the toy OS know about settings, respect them and fear them.

Dan Wade on March 17, 2009 12:09 AM

@Pseudo Language Discriminator

Ohhh Java...there's a *speedy* interpreted language. Look how it has taken over the world....oh wait..well as least you can get a job at IBM. It's always funny how when people want power and simplicity they choose complexity. Frameworks can be fine, as long as you don't plan to deviate without creating mod's.

JSP Frameworks... woohoo.. How's that AJAX implementation *really* coming along for ya?

quote:

jsp is the same shit like php (and the same ages) but there are a lot of new modern frameworks and technologies in Java that Php cannot compete with, even if Php have good frameworks too because Php is very bad language.

Today, Java has Wicket, Tapestry which are full object-oriented and forcing good design frameworks. Java has milion solutions more that Php and today Java has Javarebel - that enables to reload changes made to Java class files on-the-fly..

So Php die! Php developers can do simple pages for farmers and kids-rockstars :)
Pseudo Language Discriminator on September 22, 2008 11:21 PM

Dan Wade on March 17, 2009 12:15 AM

@dave the coder

Right on!! I hate when others bash a language - (ASM, C/C++,TCL,PERL,PHP,Python,Jython,ECL,C#,ASP ::cringing::, Delphi (Hey had to see what the buzz was LOL), TSQL, PLSQL, ISQL, MODULA (woohoo, who knew it would never be seen again), FORTRAN, JCL, LISP)

Now HERE IS A LANGUAGE THAT IS BRUTAL!! ASSEMBLER ROCKS..(For you VB guys, ASM is like Chuck Norris.... VB is like that one dude who dies in The Octagon..don't remember? See it doesn't matter LOL)

section .text ; Section Declaration

global _start ; Entry point for ELF linking
_ start:

;socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
;
;socket() args
push byte 6 ; IPPROTO_TCP (=6)
push byte 1 ; SOCK_STREAM (=1)
push byte 2 ; PF_INET (=2)
;
;socketcall()
mov eax, 102 ; socketcall() syscall
mov ebx, 1 ; socket() = int call 1
mov ecx, esp ; Pointer to our args on the stack
;
int 0x80 ; Call the kernel
mov edi, eax ; Put the sockfd [which socketcall() returned to eax] into edi
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Do a little error-echecking here...
cmp eax, -1
je sockerr

;bind(fd, (struct sockaddr*) &sock, sizeof(sock));
;
; struct sockaddr_in {
push word 0x0 ; INADDR_ANY = htonl(0x0) = 0x0
push word 0x581b ; port 7000 = htons(0x1b58) = 0x581b
push word bx ; AF_INET = 2
; }
;
mov ecx, esp ; Save a pointer to the struct
;
;bind() args
push byte 16 ; socklen_t addrlen
push ecx ; const struct sockaddr *my_addr
push edi ; int sockfd
;
;socketcall()
mov eax, 102 ; socketcall() syscall
mov ebx, 2 ; bind() = int call 2
mov ecx, esp ; Pointer to the arguments on the stack
;
int 0x80 ; Call the kernel.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


---------------------
In my opinion PHP does not suck, but this article sure does. If you want to try a language that really sucks, try assembler.
dave the coder on September 8, 2008 12:25 PM

Dan Wade on March 17, 2009 12:26 AM

Just because a language *has* 1000 functions doesn't mean you have to use them, or even know them.
http://www.setuphkcompany.com/

ytecht on March 17, 2009 3:24 AM

Yeah and MySpace (the single biggest personal networking site in the world) was developed in ColdFusion. There is NOTHING that PHP can do that ColdFusion can't do faster, better and easier.

Ray on March 25, 2009 9:28 AM

As a long-time PHP programmer I have to agree, PHP sucks. But after having spent a month hacking away at ActionScript 2 I've seen worse (unless there's some magical "Warnings" option in Flash I've been missing out on -- AS2 seems to happily do what it thinks you mean, especially with the most frequent errors such as typos (undefined variables or array indices) or implicit type conversions (compare a numeric string with a Number? Oh, gee, let's convert both to booleans!), missing semicolons (yes, I know, they're not mandatory, but they're THERE -- I wish JS/AS would finally decide whether it wants to be like C or like Python)).

PHP's problems mostly lie in the standard library and rather unique syntax (dot-operator for string concatination because plus is taken literally due to its weak typing). It's OO capabilities suck, too.

IMO if you're working on a PHP project so vast you need to use OO to make any sense of it, you're working in the wrong language. Heck, MVC is not what PHP is for -- creating a pure PHP script feels weird because you have to start and end it with tags.

PHP is essentially a quick and dirty scripting language for websites. Using a template engine on top of PHP is emulating PHP in PHP -- meta-level bullshit (besides, in the age of CSS, your HTML shouldn't define the looks of your website in the first place, so who needs templates anyway?).

PHP is a good tool if what you want is really an HTML page with some dynamic content in it. If you want a full-fledged dynamic website, you're probably better off with Java Servlets, ASP.Net or similar "higher level" programming languages.

Generating HTML content via echos and prints or using a template engine feels unnatural in PHP exactly because it is. PHP isn't pretty, but it gets the job done. DOM? Abstraction? We don't need no stinking abstraction.

It's all in how you think about what you're trying to produce. It fails horribly at abstraction (have you even SEEN what the new operator to access a namespace looks like? The syntax is getting weirder because it was never supposed to have that kind of functionality), but it's very good if you just want to put code in your HTML. If you're writing Perl or Python you'd be putting HTML in your code instead, which would tickle any programmer's abstraction sense.

Alan on May 5, 2009 12:26 AM

If I understood correctly PHP was created as a big improvement over PERL.

In PERL you had to print HTML code.
In PHP you just write both HTML and PHP where PHP simply has to be enclosed between tags.

PHP simplifies PERL syntax a lot.

PERL has arrays and hashes.
PHP only has hashes, called arrays, which do the job of both arrays and ahsahes.

PHP only uses $ as variable prefix unlike PERL where you never know hich prefix to use :).

PHP has much more intuitive way of getting function parameters.
Using _@ in PERL is very strange.

I was very suprised with PHP online help/tutorials.
I think the biggest problem of our wourld are bad or non existing tutorials making everything looking so difficult.
PHP help was so far greate for me.


ivor on May 5, 2009 6:00 PM

"sufficiently talented coders can write great applications in terrible languages"

That's a convenient conclusion! How about some other equally possible conclusions:

* PHP solves the web development problem elegantly both in terms of its templating language nature and the toolchain that goes with it.

* Something about the language and its toolchain that lets you maintain "flow" and "iterate".

* worse-is-better philosophy

* wabi-sabi?

I could go on but does it matter?

Sandeep Shetty on May 18, 2009 2:09 PM

ASP.NET sucks bigtime. i hate the way html is "generated" by server controls, as it obfuscates the output with a myriad of m$ centric tags that are not Xhtml compliant. try getting your css right is a hairpulling exercise. you dont know how it will look until the compiler spits out the html. good luck trying to get that right. Web forms are a static paradigm, not adapted to current web standards. it rapes the html id attribute and doesnt give a damn about the DOM.
your average ASP.net developer typically will produce horribly looking site because of this. Is it a wonder that social networking sites unanimously ignore it ? i think not.

Sajaki on June 8, 2009 6:49 AM

Passing "too many" function parameters is not an error and is perfectly acceptable - you can get an array of all the parameters with func_get_args(). This allows you in some situations to have greater flexibility with what you pass to a function.

Dan on July 8, 2009 4:24 PM

Great article, I had a good laugh! I've been in web development for a few years now, and while Actionscript 3.0 is my playground I often use PHP as a serverside solution. The weak typing is my first gripe with the platform but as long as I just run some AMF services (Zend or AMFPHP), it's all working together nicely, in an OOP fashion even. While not as elegant as my AS3 solutions, this works great for me and I have yet to run into something else that will make chatting with a database model this easy to code, and to maintain that code properly. I also never have any compliance issues between the XML PHP5 can natively generate and what browsers or Flash will accept.

I think every developer at one time in their carreer put crap PHP code online. Each and every one of us wrote their first lines of code at some point, and even though we barely knew what we were doing some people noticed we got it working in the first place. So people offer a script kiddy some money to hack up a website, because a coding job he can do whenever he feels like it is a nicer way to make money at a you age then say, physical labour (oh noes!). If you don't know jack about the internet then you are not going to care. The point: a lot of people aren't tech savvy, a lot of people want a website. Cheapest route: the script kiddy next door. But does it really matter in relation to PHP? I find that hard to believe.

I guess that if any other language would be as populair, it would be raped by script kiddies just the same. That doesn't mean you can't find a decent purpose for PHP or code nice OO applications with it. Maintaining your own server ups the learning curve a bit, but it's not that hard as even this artistic frontend developer could configure PHP on his own (I even prefer to configure the files themselves instead of using the GUI a WAMP5 install gives you). It's shared hosting, a natural development of stuff being on different machines that's to blame, not PHP itself. I'm lucky I've got a host that will install stuff on demand for me, to mimick about anything I run at home. Having FULL control over PHP is VERY different from uploading a 800Kb index.php to your free hosting account to make 100 bucks and a free haircut.

Inxentas on July 9, 2009 3:06 PM

I think you will make these projects into a success also!

Sexy costumes on July 13, 2009 6:42 PM
Content (c) 2009 Jeff Atwood. Logo image used with permission of the author. (c) 1993 Steven C. McConnell. All Rights Reserved.