Ruby vs. PHP, round #19238 2

Posted by Matt on August 25, 2008

I just translated an old PHP function to its Ruby counterpart. I think it really showcases Ruby’s elegance:

PHP Version:

Ruby Version:

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Nuno Mon, 25 Aug 2008 17:27:42 PDT

    Pretty cool, indeed. Thanks for sharing. I’m in the process of deciding which dynamically-typed programming language I’m going to learn next, and your constant praise of Ruby definitely makes me increasingly curious. Being a Java developer, I’m obviously considering Groovy [groovy.codehaus.org/], but also Python and Ruby.

  2. Matt Mon, 25 Aug 2008 17:43:59 PDT

    Haven’t tried Groovy yet, but I’ve done both Java and Python in the past. All three have their strong points, but Ruby makes me remember why I like programming. It gives me powerful, elegant tools and then steps to the side, allowing me to do what I needs to get done.

Comments