You are using an outdated browser which puts all net citizens at risk. As an incentive to upgrade to a current and thus much more secure product (we recommend the free Firefox browser), you won't be able to visit this site in its cute design, but in this rather boring printer-ready version only. Thank you for considering a browser update!

10 Reasons why PHP is Still Better than Ruby ;-)

1. Safety

Remember Gregg and Jason in their Ruby on Rails vs PHP clips? The Rails guy goes to the beach while the PHP guy still tries to switch databases. Turns out hundreds of people die every year on beaches whereas the risk of dropping dead on your desk is next to nil. In fact, driving to work and most things you do during your spare time are far more life threatening than working on code and therefore the longer it takes, the better for your own personal safety.

2. Semicolon

Programming languages without a semicolon at the end of each line are like a fish without a bicycle. Nuff said.

3. DRY won’t Pay your Bills

Unless you’re workin on a project of your own, producing as little and maintainable code as possible will mainly DRY up your paycheck. You spend less hours copying and pasting, less hours fixing the same bug on ten different lines and less time finding bugs in the first place. But remember: Time equals cash when you’re contracted by the hour. So we should be grateful for PHP and frameworks like Zend which make it so ridiculously easy to write the most cumbersome code full of duplications.

4. Namespaces

Colliding classes which happen to have the same name can indeed become a problem, however, Ruby-style namespaces with module MyNamespace are by no means the only solution. The makers of PHP chose not to overload it’s lean syntax with such unneccessary keywords and urge coders to prefix the class name like class MyNamespace_MyClass instead.

Nevertheless, in order to satisfy those who still long for namespaces, PHP will support the namespace keyword as of the yet to be released version 5.3.

5. Goto

The presence of a goto language construct has been considered evil for decades now, yet not the keyword itself is evil but what a tiny minority of coders would use it for. In other words: Messy software developers are used as an excuse to discriminate the Methuselah of keywords.

Discrimination is fundamentally wrong! The makers of PHP have realized that and will will support goto as of the upcoming version 5.3 whereas for Rubyists the ruby-goto library (categorized Library/Evil) is not even available as a gem.

6. Elseif

Cascading if clauses contain at least one “else if” case, so the natural way to name this keyword is elseif – as does PHP. Ruby on the other hand uses elsif which is so much harder to remember.

7. Solid and Static Foundation

Ruby is a highly dynamic programming language which allows you to twist and tweak almost every aspect of it. Therefore all it takes is for someone to accidentially monkey patch the + method of Float and your application goes kaboom. PHP on the other hand has a rock static foundation which means array_uintersect_uassoc() does exactly what it sais, which is… well, check the documentation for that. And if you absolutely must change it’s behaviour, you can always write your own my_array_uintersect_uassoc().

Admittedly, the Ruby syntax is more elegant and easier to read. However, if elegance is your aim in life, you’d better become a poet. Fact is that my granma could read and understand this piece of Ruby code whereas it takes a lot more expertise to figure what the PHP snippet is doing. Software developers should face the fact that they are paid for expertise, so making things hard to read – best coupled with poor documentation – will make you less disposable on the long run.

At first sight this seems to be bad news for PHP as it falls way behind the others with Ruby closing in on Perl. Then again in the real world with real customers it’s much easier to get a fair price for your software project if you can sell bits and pieces with: “There is no solution available out there, we’ll have to do it ourselves.”

10. Bugs are your Friends

You just have to learn how to sell them, too. Don’t believe the “half a product, not a half-ass product” stanza by the nice yet overly idealistic folks at 37signals (Getting Real, chapter 5). The real buck starts flowing once you force your customers to constantly upgrade or even contract your consulting services.

This said, PHP is the ideal choice. There are testing frameworks out there, even BDD has made it to the PHP world, but fortunately the PHP syntax is twisted enough to make the descriptions quite illegible. Compare the code samples from the two project webpages:

By working with PHP you can rest assured that 99.9% of the lines of code out there won’t come with tests and given the syntactical challanges that’s not going to change. Therefore, PHP is the perfect ecosystem for bugs to grow and continue to play an important role in selling bugfixing to customers.

Comments

This is really cool, didn’t read something this funny i ages, not even on 1st April :-)

ActsAsFlinn
said on Wednesday, April 08, 2009:

The delivery is so dry that it almost comes off as serious. Very nice.

Paulo Alziro
said on Wednesday, April 08, 2009:

Funniest post ever! :)
Have you ever planned in presenting it on ComedyCentral?

remi
said on Wednesday, April 08, 2009:

best. post. ever.

you are my new favorite person.

Andy Jeffries
said on Thursday, April 09, 2009:

Thanks for the mention ;-)

(and no, I wasn’t googling my name – it came up in an RSS feed I subscribe to and I was interested – thinking you were being serious)

Anonymous
said on Thursday, April 09, 2009:

Funny article, and I agree with everything. But to be fair regarding #9, you can’t really limit PHP to Pear. If there is one thing that makes PHP easy for beginners, is that there is so much (crappy) code out there to copy and paste.

gaj
said on Thursday, April 09, 2009:

At the risk of being pilloried by both the PHP supporters and the Ruby supporters, according to search.cpan.org there’s over 67,000 modules in CPAN. At 523 Gems per year Ruby still has a long way to go to catch up to Perl (although at the rate Perl mongers are deprecating old fashioned modules, Ruby might only have to stand still). (See chromatic’s Modern Perl comments)

Re: That’s an interesting observation, indeed. The complete list of modules on CPAN shows a much lower (but still growing) number.

Damien
said on Thursday, April 09, 2009:

First, you should know that I’m entirely pro ruby.
However for point 8, I don’t agree.

$bar = array_slice(sort(array_keys($keys)), 0, 3);

It’s as easy to read as ruby when you’re used to it ;-)

Re: Unfortunately that won’t work because sort() returns a boolean and not the sorted array.

P. Prikryl
said on Thursday, April 09, 2009:

> Re: Unfortunately that won’t work because sort() returns a boolean and not the sorted array.

Is it my impression or some Ruby and other language developers still have a deep envy of the success and dominance of PHP on the Web? ;-)

Dont’t be evil, get over it! ;-)

Renan
said on Friday, April 10, 2009:

CPAN now has 17488 distributions, each containing many modules (67343 total). I don’t know much about the ruby community, but what do you get when you upload a gem to rubygems? On CPAN, you automatically get world mirroring, smoke tests on many platforms (reports, statistics), a bug tracker and forum for your dist, among other things.

Re: This explains the difference in numbers, thanks for the enlightenment!

Ah, and I know this post is about PHP and Ruby, but in Perl it would be something like:
@bar = (sort keys %foo)[0..2];

Re: Touché ;-)

hosiawak
said on Friday, April 10, 2009:

The best summary ever why PHP is still better than Ruby, I laughed a lot :)

Luke
said on Friday, April 10, 2009:

I started ruby today, yet some how I still understood your jokes.
I guess it must be because PHP has just been so good to me over the years..
:)

Tibastral
said on Friday, April 10, 2009:

I stop TODAY doin’ ruby.

Belpoub
said on Friday, April 10, 2009:

Well I will go back to PHP, nope, the best of the best: interpreted basic with no object at all, no classes, and plenty of goto. Hum… maybe cobol is still alive.
My preferd was APL in the 80ies, a succession of hieroglyph (ancient egyptien), totally unreadeable (1 charracter=1 function and you can’t associate the character to an a or a z, its hieroglyph), that’s good for building a dynasty of bugs and fixes….You can’t read your own code, how can somebody else?

rubyisfortrolls
said on Friday, April 10, 2009:

Ruby is for trolls and newbs. It’s a great language, but not for the web. period.

Re: Because the web consist of 90 percent crap, not the right habitat for any great language.

B.R.Dock
said on Saturday, April 11, 2009:

Man, changing from PHP to Ruby was the best thing I’ve ever done. Made my life about 500 times easier, less stress, and more fun!

I like the fact that you get more done, in less time, with clean(er)/revisable code. More pleasure, money. Also the whole “Convention over Configuration”! No need to think about stupid things, also better when working in a team, without annoying anti-social asswipe programmers that only go by their own rules! I’m glad I stepped out of that world!

Nice post by the way.

Wayne B
said on Saturday, April 11, 2009:

Ruby is a nice language and all, but can it run big sites like Facebook?

Re: Seriously, how many Facebooks have you coded? On a more realistic scale: Github is a Ruby on Rails app. And here are a few more examples.

Also, is Ruby used widely enough so that I can easily find resources for building stuff with it?

Re: Absolutely, Ruby has a very active and helpful community. Stay tuned, I’ll post my linkroll in the upcoming days. For now, check out Rails for PHP developers where you can search for PHP commands and get snippets comparing the corresponding PHP and Ruby/Rails API.

Sven, try building a big website with Ruby. Try hiring Ruby developers, if you can find them and then come back and tell me how much better you think Ruby is.

Re: Well, Wayne, that’s what I do for a living. Besides: Many Ruby devs have worked with PHP for years – can the average PHP dev say the same for Ruby? I sincerely encourage you and any skilled PHP dev to put aside prejudice for a moment and to give it a shot, you might actually like it.

Rafael
said on Wednesday, April 15, 2009:

I like that you finally began writing blogs! It’s hellot of fun.
Thank you so much,... I didn’t care about WHY I changed to ruby, or let’s say, I try…
PHP habitat is still so big, I get to much work on this side. But fortunately, I manage to convince my clients to let the PHP thing behind and discover new agile ways…. more and more…

Leandro
said on Wednesday, April 15, 2009:

10 Reasons why PHP isN’T Still Better than Ruby ;-)

very nice post!!!

est
said on Thursday, April 16, 2009:

Bookmarked it. Shall read it over and over again to laugh.

Narshada
said on Thursday, April 16, 2009:

I’m not 100% sure, but I think I detect some sarcasm. Or maybe irony. Yep, that’s it.

scheide
said on Friday, April 17, 2009:

Nice and funny post. One more reason to still learning Ruby.

Dave
said on Saturday, April 18, 2009:

As a 5+ year PHP developer, and a web programmer (in Perl and Java as well) for almost a decade, now moving to Ruby (thank heavens!), I can honestly say: this is dead on. PHP is a garbage language that throws so many potential bombs and time-wasters at developers that it should really have been taken out back and shot years ago when it was first stillborn. And the addition of Java-style OO syntax in version 5 just makes it more stupid and inelegant. I can’t wait until PHP dies and goes away forever. I started with Perl, enjoyed it, and then cursed every day I coded in PHP…and now I have Ruby. It’s a relief.

Oh, and as far as “can you build Facebook with it” nonsense, you can build Facebook or anything with any of these technologies, even languages like PHP…smart developers can build good apps with most anything.

But the real question is: how much of your developers’ time does a programming language waste? Ruby tries very hard (and largely succeeds) – especially with frameworks like Rails/Merb – to not waste developers time, and help them expend brainpower in the right ways. It’s superior in this way to PHP.

Re: Not really, unless you count the reference to the clip by Gregg and Jason. Then again, “Half the Features, Twice the Fun: 10 Reasons why Copycat CakePHP is Better than Rails” – sounds promising.

sdwrage
said on Monday, May 11, 2009:

This is what I don’t get about developers… Everyone points their scrawny fingers to other languages and labels them “Witch” languages. How about you try both? If you like one over the other then great! but lets say for one second that you liked both… wouldn’t it be great experience to have under your belt and also know which to use for what job? seriously people ;)

Believe me, I have tried both. (10 years of PHP, even Zend certified.) The reasons for using PHP are non-technical, e.g. “the client insists” or “legacy system”. But coding doesn’t feel right the way it does with Ruby.

Raw
said on Friday, May 15, 2009:

Hi, can you suggest on a decent book to start on? i would like to finish through a book before going for advanced stuff. i am tired of a lot of things with Java. I really feel a want to learn something new.

Re: Personally, I like David A. Black’s “The Well Grounded Rubyist”.

dave
said on Tuesday, June 09, 2009:

I’m for php.

Let’s face it, OOP is just not appropriate for websites, large or small. Mine turn over £2.5-3M (not that I get much of it), but the most important factor was speed to creation, not OO statergy.

OO rarely ends in reusability, whether it be implemented in c#/java/ror/php.

chris
said on Saturday, June 27, 2009:

Unfortunately I dont’ believe Ruby will be there big time in 10 years from now i.e it will still be a small niche player.

I have played with ruby myself a little bit, on and off since 2006 , I know I am a late comer. these are my thoughts about Ruby.

1) after so many years, it’s still like 2% in the Tiobe ranking

2) its weak typing, many people have said this is an asset, but I don’t. agree. Weak typing is a dsadvantage in my experience (working with very large apps in a big Financial Institution, running 24×7 ). Rubyists have always countered with a “do more testing” approach , but I don’t agree this will catch all your problems. I believe you have to have strong typing combined with a “do more testing” approach is better, especially when you are working in large teams where every one can touch any code.

3) speed is still a problem after so many years, everyone knows it’s a problem and yet the community is so slow to address that.

4) by the time, the ruby language and framework, has fixed its problems, the fad will have died and tne crowd will have moved on to the next big thing.

5) features in ruby is being and will be copied in existing languages and new languages

6) there are too many ways of doing the same thing in Ruby and this is a disadvantage as well, as this means if you are working in a big team, you have to learn every little nut and bolt of the language to be able support an application. that means, the learning curve is actually higher. In a one man team this is ok, because that one man picks one style and sticks to it and doesn’t have to worry about other people’s coding. It’s like driving on the street, you don’t have to think if the car next to you is going to drive left or right, and this prevents accidents. can you imagine for one moment that people are allowed to drive left and right in any direction ? what will happen?
I am aware that Saphire is trying to redo Ruby, with only one way of doing things. maybe this will help.

7) I think it’s safer in terms of longevity of languages to stay with Java and .net. because at some point Ruby will be forked and a new variant with a lot of differnt things added, will come out, fragmenting the market even more, which will reduce the current 2% to even less.

8) the big institutions are not doing Ruby. only startups, with basic CRUD applications.

9) last but not the least, the absence of a specification hurts the language. by the time the specs will come out and “accepted” by the community, it will be too late. Languages like Scala will already be well established.

10) the community looks and acts too amateurish. I don’t believe even Sun’s and Microsoft’s presence will be able to change that. Unless they fork their own versions, in which case that will cause fragmentation of the ruby community, with its adverse impacts to the ruby community as a whole.

anyway these are my thoughts. sure people may disagree with what I said, but every one is free to one’s own opinion. Let’s wait and see, only the future will tell whether one is right or not

Clay
said on Thursday, October 22, 2009:

I came here actually expecting to read about serious advantages PHP has over Ruby.

Your main focus is the money you do and your old habits.

I mean do you have a real concern about Progress and giving your BEST to the people who hired you? – What is that talk about bugs are your friends? – What about trying new things and exploring new concepts?

Sure Ruby is far from perfect, but I read better reasons to prefer PHP in some comments, rather than in your original post.

Re: Writing satirical articles would be just half the fun if everybody got it. Get it?

If you just care about the easy money you make and not about efficiency, progress and evolution, saying you work in anything relating to computing, or web in particular, is basically an insipid oxymoron.

Antonio
said on Monday, January 11, 2010:

Very funny. Your vision are the definitive reason for me to learn ruby NOW.
Thanks from Spain!

Tuhin Kumar
said on Saturday, January 16, 2010:

Never coded anything besides some lines in Php on Wordpress (I said never) … yet I could understand the apt irony. Maybe that goes to bare C. C++ Skills but yet an amazing post whatsoever. Brillliant! :)

Tristan
said on Friday, February 05, 2010:

The title of this post should actually be “10 reasons why PHP is still better for professional developers than Ruby”. And by professional, I mean people who are paid to code, not developers who are just really good.

Good post though!

franky
said on Sunday, February 14, 2010:

i like to use php for my client.. specially when the client are big company… however for my own sites i use ruby all the time

FOA
said on Friday, March 05, 2010:

Sorry, but your text is really boring… Maybe some kind of amusement for scriptkiddies and all the “i-hate-PHP-and-i-don’t-know-why-i-just-do-it-cause-the-others-say-so” idiots but nothing more.

Thought first to read here something really funny but it’s the same “bla bla…, PHP is so bad and f*cking ugly and how were i used to write it for years and years” – sh*t like on any other sites….

You know, it’s not that you really don’t like PHP or something, but the point is:

If you don’t like something why don’t you use something else which makes you happy instead of investing that much time, effort and skills in showing the whole world WHY that thing you don’t like is so bad and useless ?!?!

Re: Well, ask yourself. You could have ignored this article but chose to read it and comment, why?

It’s like all the boring flamers and haters which daily flame aganinst Apple, Microsoft, Linux, Windows, and so on…

If someone doesn’t like the iPhone, why don’t he use a Blackberry, Nokia or something else and will be happy? What is there behind the scenes that these people invest hours, days, months for sh*t like these?

Re: Because people like to share their findings, some by means of technical analyses, others in a satirical way. I apologize for boring you, however, I find your comment quite amusing, so it was worth it.

I don’t understand and i won’t even in future…

Anyways, good luck with your career or whatever you do… ^^

Re: Thanks, same to you… ^^

Sophie
said on Sunday, April 25, 2010:

Hi, everyone – I’d greatly appreciate hearing your recommendation on this: If you were building eBay today from scratch, and are on a tight budget, but want to build it as fast as possible, would you use PHP or something else?

Looking forward to hearing from y’all!

Re: My weapon of choice is Ruby on Rails as it covers most of the essential needs to do rapid prototyping without imposing say the kind of database. Furthermore, the Ruby community embraces test/behavior driven development way more than PHP developers do. And without proper testing, you will sooner or later face a pile of unmaintainable code.

Gustavo
said on Monday, May 03, 2010:

I believe that PHP is better than Ruby. But these 10 reasons are not rational. If a simple and readable syntax threaten your job then you are missing something to offer, it sounds like a lie, you could make easier and faster but prefers to do more complex and time consuming to charge higher values? The evolution that gave rise to the high-level languages did not disappear programmers.

Re: I honestly hope the sense of humour and technical expertise don’t sit in the same spot in our brains.

Tim
said on Tuesday, August 03, 2010:

I can’t believe some of these people missed the satire. It confirms my suspicion that many developers aren’t actually all that bright. Nice article dude!

tektos
said on Tuesday, August 10, 2010:

A lot of programmers use php, but not because its better its because they have no idea how much better ruby is or they dont even know ruby or dont want to learn a better language because they are old, kiddies or no serious programmers. So come into the beautiful world of ruby ;)

Claudson
said on Sunday, January 02, 2011:

It’s a funny post. lol
Really, so many people use PHP by be a language easy. Ruby is too easy of learn, but I think that “on Rails” (the major use of ruby-web) cause afraid to somebody.

kratos
said on Wednesday, February 16, 2011:

Well, the fact is that the best language / framework is the one we know better. Comparisons are useless because they usually only reflect a personal preference or are used by companies to mislead a customer. Videos Ruby on Rails vs Any other language uses stereotypes that oversimplify reality or states facts that are not true.

Daza
said on Saturday, February 19, 2011:

I found this site because I was looking for info on whether I should learn PHP or Ruby. I suppose I needed convincing either way becaue although I found Ruby code easier to read and figure out, I was always being told that PHP was the way to go, but I can’t stand the look of PHP code, it makes me squirm. So, many thanks for a brilliantly funny post, you’ve convinced me to go the Ruby way.
Oh and btw, are people who hate on you for writing this real?

Re: I hope so. Quite an unbearable thought that everybody got a sense of humour all of a sudden.

Anthony
said on Friday, April 15, 2011:

As I started reading this article my blood pressure slowly started to build, and build. Just as my eyes were about to explode out my head, I realized it was a joke – I was trolled, and it felt good. This is a great post, thanks for the laughs!

vaibhav
said on Wednesday, June 01, 2011:

cool work dude …….. but in indian software companies you are hardly given anytime 4 it to choose as they handover the technology to u.

Mathias
said on Saturday, September 24, 2011:

Awesome. You’re the best defender of PHP ever. :)

Illuin
said on Thursday, February 16, 2012:

Wit or no wit, it’s no wonder the Ruby community has the reputation that it does. Just a bunch of amateur, arrogant, pompous wannabes that actually post this biased, ideological junk. It’s a shame a good language is tarnished by a immature, pretentious community. The very reason only 2% of programmers are involved with Ruby (which has actually been around as long as PHP) is because it is surrounded by arrogant juveniles. I personally like Ruby as a language, but the PHP community consists of far nicer people.

Re: Wow, by using such colorful language, you really add an extra layer of credibility to your comment. Chapeau!

StevieW
said on Wednesday, February 29, 2012:

Sigh when will the internet programming elitists realize that you can write simple, elegant code that works well and fast in any language?

Re: If this were true, how come programming languages are evolving at all?

If I like PHP does that make me a bad programmer? I like the fact that it has a ton of built in functions. I like that it has a very lenient syntax, which allows me to write one-time-use scripts in minutes. I like the fact that it’s been around a while and has a ton of support. I like the fact that it compiles down to C code. I like that when picking a framework, there are many options depending on the type of project, not just 1 framework with a “one size fits all” feel.

I don’t care if you believe me, at my company I am the star programmer. When something needs to be done and it needs to be done right and fast, they come to me, and all the other coders know it. My weapon of choice is PHP. I can write PHP code that will make you realize you don’t know crap about PHP. So before you stick your nose up at people because they prefer a different language than you, just remember, you don’t know everything, and just because you are using the newest most hip technology, it doesn’t mean you’re right.

Re: You’re right, I don’t know everything. But I’ve seen awesome PHP code. And unlike you, I can imagine how it would translate to stunning Ruby code, because I’m fluent in both.

One thing I will say is that Ruby writes elegant code for you while PHP requires you to actually think and plan ahead to write elegant code. Fine, you’re right, if you’re a bad programmer that doesn’t plan ahead, Ruby will make your code readable. But if you come from a C/C++ background like I do, you know that elegant code comes from forethought, not language choice.

Good day.

%(reply)I read something else between your lines: Fear. Now that you’re finally the PHP star, it’s a scary thought to switch horses and start from scratch. Well, not true! Like you say, a good coder is a thoughtful coder, so if you’re indeed the PHP star you claim to be, then your asset is not primarily the PHP knowledge but your sense of how to design solid code.

Give it a shot, you might like it!%

da bishop
said on Wednesday, May 09, 2012:

TBHPHP was evolved to fill a gap in the web development scene between HTML and CGI. There are now much, much better solutions for that issue, of which Rails is one.

As to 10 years time, I wouldn’t care to comment, but I would be surprised if any of the major server-side languages have gone away: Python, Java, Ruby. Not many people in 1997 thought that most of the web would still be running HTML 4.0 in 2012.

ecorex
said on Tuesday, October 30, 2012:

Go and continue to deceive yourself, PHP is still the far beyond ruler of web scripting. And seem there are at least 10 years to the fall and the future is Python not any other ….