Ruby on Rails vs. PHP

Ruby on Rails and PHP are two very popular ways to create web applications. But how do you choose which one you want to use? Ruby on Rails or PHP? Let’s look at the differences in this article.

What are Ruby on Rails and PHP?

If you’ve spent any time around developers in the last few years, you would have heard of Ruby on Rails. Ruby on Rails is actually a combination of two technologies – Ruby, which is the programming language, and Rails, which is a framework built on top of the Ruby language.

It’s quite a popular way to build websites and web applications these days.

PHP, on the other hand, is a programming language. It doesn’t refer to a framework, although there are many frameworks built on top of PHP.

So, Ruby on Rails vs. PHP is not quite a straight comparison. It’s asking which is better – a language, or a language + framework.

But what if you wanted to learn one and wanted to know which one was better? There isn’t really a way to say which one is better overall, as it comes down to your preference and your needs. In this article, I’ll go through some of the pros and cons for each and how they impact both Ruby on Rails and PHP.

Learning Curve

The learning curve for PHP is very shallow. This means it’s an easy language to learn.

To write PHP, all you need is a HTML page, a way to translate the PHP code (a Web server) and start adding PHP tags into a PHP file. You don’t need a compiler or any special tools to create this PHP code.

Ruby on Rails, on the other hand, is harder to learn. I’ve seen many tutorials around the Web and many courses on Udemy that show you how to use Ruby on Rails to write a web application pretty easily, but other sources say that Ruby on Rails is actually harder to learn.

Because Ruby is the language and Rails is the framework, to learn Ruby on Rails you actually need to learn the Ruby language as well as the Rails framework. This can cause developers a bit of trouble and makes it hard to learn than PHP.

Resources and Getting Help

PHP is one of the most, if not the most, widely used web development languages on the Internet. It has been around since 2004 and has had quite a few iterations and releases of the core functionality. Many of the most popular websites use PHP (such as Facebook) and the most popular CMS, WordPress, is also developed in PHP and used by a lot of websites worldwide (including this site, Complete IT Professional).

As a result, there is a lot of documentation that exists for PHP. The official documentation for PHP is quite good and there are a lot of other websites around that offer PHP help and support.

Let’s compare this to Ruby on Rails resources. They have their own documentation as well which can be useful, but difficult for a first-time programmer to use.

StackOverflow is a common way to get answers for your programming questions. There are a lot more questions related to PHP than to Ruby on Rails. At the time of writing, there are 1,460,272 questions with a tag of PHP and 337,092 with a tag of ruby-on-rails.

Ruby on Rails vs. PHP Developers

In general, it’s a lot easier to find a PHP developer for your project than it is to find a Ruby on Rails developer. This could be due to the long-term popularity of PHP and the fact that it is easier to learn.

If you’re working on a project where you need to develop in one of these two technologies, you may need to get other developers into your team. The ease of getting other developers may be a factor in making your decision.

The quantity of developers and the ease of learning can also be a negative.

Because PHP is so much easier to learn, many people are writing PHP code that is pretty bad quality. It’s hard to maintain, slow, and messy. These developers would then be classes as “PHP developers”, and it can be hard to find a good PHP developer who follows programming principles and not find a low-quality PHP developer.

You can be a little more certain when hiring a Ruby on Rails developer that they will be a better quality developer, due to the standards that you need to follow when developing with Ruby on Rails.

If, on the other hand, you’re looking for a job with Ruby on Rails vs. PHP, the numbers are quite different. Using Dice.com, as it’s one of the largest websites for IT job searches:

  • 3,021 PHP jobs available
  • 3,779 Ruby on Rails jobs available

According to LinkedIn, there are:

  • 1,830,346 people results when searching for PHP
  • 163,049 people results when searching for Ruby on Rails

This shows that there is a large number of developers who know PHP compared to Ruby on Rails, but there are more jobs available for Ruby on Rails developers. This could be because the popularity of Rails has really taken off recently, and many companies are looking for developers with this technology.

However, as mentioned above, this might not be a fair comparison as PHP is an entire language and Ruby on Rails is a combination of a language and a framework.

Quality of Code in Ruby on Rails and PHP

I mentioned earlier that there is a steep learning curve with Ruby on Rails. As a result, the quality of Ruby on Rails developers overall may be higher, due to inexperienced developers trying to learn PHP and hacking together code just to get it to work. It’s harder (but still possible) to write bad code in Ruby on Rails, and therefore, the quality is generally better.

There are many frameworks out there for PHP which allow different standards for development, and as a result, can ensure that the quality of code is better.

But, the quality of the code ultimately comes down to the developer.

If you’re a poor web developer, then you’re going to put some code together that might work, but has issues later and breaks in certain situations, and is hard to maintain. If you’re a good developer, your code is going to be efficient, easy to maintain, and relatively bug-free.

This is the same for PHP and Ruby on Rails – as in, it doesn’t matter which language you use.

So, while the quality is really dependent on the developer, you’ll find a lot more lower quality PHP developers out there than Ruby on Rails developers, and therefore, more low quality PHP code than Ruby on Rails code.

Conclusion

So, to conclude my analysis of Ruby on Rails vs. PHP:

  • PHP is a language, Ruby on Rails is a language (Ruby) with a framework (Rails)
  • PHP is much easier to learn than Ruby on Rails
  • Developers are easier to find for PHP than for Ruby on Rails
  • Both are quite popular for job listings
  • Documentation is more prevalent for PHP than for Ruby on Rails

If you’re looking for a specific technology to learn and your choice is down to these two, then I hope this article has helped you make that decision.