Ruby vs PHP Syntax Examples

I was mulling through some old code I had done on a drupal PHP based project a year ago and thought it might be interesting to show a few examples of syntax differences of basic PHP and Ruby one liners.

I only did around 15 of them but feel free to add your own in the comments if you have any that show off clear syntax differences between Ruby and PHP. You be the judge of course.

Examples of Ruby Syntax vs PHP

Ruby on Rails Cheat Sheet Collectors Edition

This Ruby on Rails cheat sheet is a reference guide for that will be continuosly updated and improved as new features are added to rails and new cheat sheet tips are added to the guide. It is a collection from the one of the very best guides, apis and source snippets that are concise that i’ve found. I’ve fixed errors and added highlighting to it and it is a mirror of the one found on nanorails site plus my own changes. New updates will be posted to this post under Recent Updates.

8 Upcoming Ruby on Rails Books You Do Not Want to Miss

Rails is rapidly developing as a framework and to help us keep up with the pace, several publishing companies out of the kindness of their hearts (muahaaha) have contracted some of the finest minds in the rails community to author some upcoming books. These are books that rails developers should keep a very close eye on. Without further adeu, here they are:

Ruby 1.8.5 Released - Summary of changes and does it work with Rails 1.1.6?

With some excitement by some and frustrations by others, Ruby 1.8.5 was released this past weekend. According to this post from Matz, the creator of the Ruby language, this is primarily a bug fix release. If you want a blow-by-blow account of the changes, view the change log and scroll down to Fri Dec 24 of last year when Ruby 1.8.4 was released. If that’s a little too much detail, here is a nice summary of the changes: This page lists the changes between 1.8.4 and 1.8.5.

Locomotive is Ruby on Rails One-click install for MacOS

Installing Locomotive

Drag-n-drop is all there is to installing the Locomotive Ruby on Rails package. Try Ruby on Rails without worrying about breaking

your current system - it’s entirely self-contained. You can always muck around on the command line and irrevocably modify your system with a custom install later, but after trying Locomotive, most people don’t need anything more.

Installing Ruby, Ruby on Rails, MySQL and Rmagick on Windows

Installing Ruby Language Support

  1. Install Ruby using the Ruby one click installer -

As of the writing of this article, 1.8.5-21 is the latest version. There have been problems reported in using ruby 1.8.5-21 with the latest versions of edge rails. I can safely say that using 1.8.4-20 which is also available for download will be your best bet.

Ruby Sets Look Alike

Here's a small example of ruby sets that I picked up. Fun but actually useful if abstracted for other applications. One thing to note, it only contains half the alphabet so you'll only be able to create cases with the letters provided. Do yourself a favour and have some fun filling out the rest of the letters. Then you can talk in l33t c0d3 with your friends.