Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

Comparison: Ruby vs PHP, the Pros

Just to be clear, this is NOT a fanboyism post nor do I encourage the debate between which language is superior. My personal belief is to use the appropriate tool for appropriate projects.

PHP Pros

  • Widely available libraries (including PEAR and PECL)
  • An absolutely outstanding online manual
  • Relatively easy to learn (can hack together some code without deep understanding of the language)
  • Widely used (easy to find clients, etc)
  • Most if not all control panels have PHP integration
  • Development packages (XAMPP, WAMP, MAMP, LAMP, etc)
  • C style syntax (easier transition for people with C/C++/Java background)
  • Powerful array feature (Ruby’s equivalent to PHP’s associative array is Hash, which is not interchangeable with array)
  • PhpDoc is better than RDoc (this might be because I am too used to PhpDoc)

Ruby Pros

  • Fully object oriented
  • Rake (Ruby’s Make)
  • RubyGem (Ruby’s apt/yum)
  • Code blocks
  • ‘Ghost’ classes
  • Modules (aka namespace/package, PHP 5.3 will have namespace too, but with much uglier syntax)
  • lambda functions (PHP 5.3 will have this too, but not as powerful)
  • Children-aware parent classes (‘inherited’ hook)
  • Multi-inheritance through Mixins (PHP is single-inheritance)
  • Ruby 1.9 is unicode friendly (PHP 6 will be)
  • For what I do, Ruby on Rails > all PHP frameworks combined
  • Regular Expression built into the language core

I am pretty sure there’s heaps of pros for both PHP and Ruby missing from the list, but at least it gives you a rough idea on what to look for if you are not very familiar with them.

Please share your experience with us too (and I will update this post accordingly). :)

  • Digg
  • DZone
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts

Tags: , ,

Comments Section

5 Responses to “Comparison: Ruby vs PHP, the Pros”

Sidebar might be covered by comments ... consider it a feature! ;)
  1. 1

    What do you mean by Regular Expression built into the language core? PHP has this regex built in using PCRE and EREG.

    Also, you failed to mention the best feature of PHP: It scales.

  2. 2

    You also forgot to mention PEAR and PECL as features of PHP.

  3. 3

    Thanks Shadowhand, I’ve updated the post to include reference to PEAR and PECL. As for the regex, it isn’t a huge deal hence why I only mentioned it at last, the reason why I have put it there is because Ruby’s OO nature makes regex more tightly integrated with other aspects of the language. :)

  4. 4

    I was thinking PEAR is a con..

  5. 5

    @EllisGL. PEAR and PECL are pros.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>