PHP Sucks, But It Doesn't Matter

May 20, 2008

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
407 Comments

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 4:49 AM

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 4:57 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 6: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 6: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 8:04 AM

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 8:17 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 8: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 9: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 10: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 10: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 10:21 AM

Well I think that ASP sucks.

Jeff Atwoode on May 23, 2008 11: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 11: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 1:25 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 2: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 3: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 3:26 AM

If something is stupid, and it works, it's not stupid.

Mattkins on May 24, 2008 5:40 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 7: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 8: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 8: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 1:57 PM

Yahoo also has a large portion that has been developed in PHP.

Mark on May 25, 2008 8:51 AM

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 8:54 AM

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 2:31 AM

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 5: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 5: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 7: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 8: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 9: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 1: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 1:16 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 2: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 7:18 AM

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 9:42 AM

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 10:49 AM

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 1:08 PM

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 2:33 AM

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 10: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 11: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 11:34 AM

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 2:53 AM

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 2: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 5:57 AM

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 8:07 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 10: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 1:19 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 5: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 8: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 9:32 AM

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 4:24 AM

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 4: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 2: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 4: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 4: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 7: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 12: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 4:16 AM

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 11:14 AM

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('xmlpotato/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 4:55 AM

php does not sucks, it has so many built in functions
:P

grinder on July 18, 2008 4: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 2:35 AM

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 4:18 AM

I think php is perfect in website.You can easy to build a website in php.

bkkkd on August 25, 2008 6: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 1: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 6: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 6:17 AM

You're wrong! A lot Php programmers go to .Net after about 10 years.

Php Follower on September 12, 2008 6: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 6: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 6:37 AM

Php isn't even real programming language but Html templating system with database interface

Pseudo Language Discriminator on September 12, 2008 6: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 9: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 11: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 12: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 12: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 4:05 AM

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 1:39 PM

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 2:25 AM

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 AM

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 AM

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 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 4:24 AM

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 1:09 PM

@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 1:15 PM

@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 1:26 PM

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 10:28 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 7:00 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 1:26 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 3:09 AM

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 7: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 5:24 AM

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 4:06 AM

I think you will make these projects into a success also!

Sexy costumes on July 13, 2009 7:42 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 February 6, 2010 10:24 PM

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 February 6, 2010 10:24 PM

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 February 6, 2010 10:24 PM

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 February 6, 2010 10:24 PM

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 February 6, 2010 10:24 PM

«Back | More comments»

The comments to this entry are closed.