Comparison between Php and Ruby? What's the difference? Which is better language?

Hello everyone ! :slight_smile:

I am confused and i need your help.

  1. What’s the difference between Ruby and Ruby on Rails?
  2. Comparison between Php and Ruby? What’s the difference?
  3. Which is better language? Php or Ruby? Which has more advantages/ benefits? And with which can you make more " things" ?

Thanks in advance !

Ruby is the programming language like PHP
Ruby on Rails is a full stack framework like Laravel.

Comparison between Php and Ruby? What’s the difference?

Lots :slight_smile: Completely different languages so the syntax is wildly different.
Ruby is far more Object Oriented e.g. you can even call methods on numbers

3.times { print 'Hello' }

Which is better language? Php or Ruby?
Which has more advantages/ benefits?
And with which can you make more " things"?

Ruby is by far a better designed programming language.
PHP was built for constructing HTML with dynamic pieces, Ruby is a more fully fledged programming language that can be used anywhere - not just in the context of web pages. If you are building web pages though you can do exactly the same thing in Ruby as you can in PHP though - they will both simply output HTML just like any other server-side language that generates HTML.

There is no “better” language. There are many reasons to choose either. Read up on each (as well as Python), try each out and see which you like the best. After you learn that one, then go on and learn the other two.

We disagree there, all programming languages are not created equal.

Take a look at this :

I would like to hear your opinion my friend.

The Ruby and Rails fad has come and gone. The hipsters have now moved on to nodejs. Meanwhile, PHP was dominating the web scene before Rails, and continues to do so today. My point? If you want a career in web development, learn PHP first. Then learn Python, because that is an arena that is growing rapidly beyond just web development. Honestly, Ruby is headed much the same direction as Perl, as far as career options go.

This isn’t on topic for this post. Your question was about about the differences between PHP and Ruby and which is better. You’ve got plenty of response on that thread already

Now we know that you’re hugely biased and not even interested in looking at the strengths of different programming languages. Touting it as a toy or fad really undermines any point you would try and make.

I didn’t learn web technologies because I wanted a job, I learnt them because I was genuinely interested by them. I’ve developed extensively in PHP, .NET, Rails, Python and a bit of Java. Ruby and Python are the most enjoyable programming I’ve found to develop in, requiring far less code than others. Because most of programming is reading and writing code I consider them the best options today.

When talking about the the design or capabilities provided by programming languages, it’s through nothing but ignorance that you’d put PHP at the top of a list. It was never designed as a programming language, it was first Personal Home Pages and it’s design has been constrained by the number of sites running older versions to improve the language in any meaningful way. PHP is a junk drawer.

My post was in response to his regarding employment. That’s what I mean by “fad”. I already do have working knowledge of Ruby/Rails, no expert by any means, but I know it well enough to prefer Rails over Django, which I do know quite well.

I didn’t put PHP on top of any lists regarding language design. In fact, if it weren’t for Ruby’s influence, I highly doubt PHP would be as good as it is today. And despite YOUR biased protests, PHP is indeed a great tool for web development. Not recognizing that fact is ignorance. It’s success and dominance in the market speaks for itself. He asked which language to learn, I told him PHP first, then learn the others as well, because no real programmer knows only one language.

So, should i learn Php first? And then Python ?

I know that Python is great nowadays. However, do you believe that Python is better than Ruby?

Nowadays, i do not think that Ruby has more popularity and growth than Python. Correctly or not ? . Okay, you insulted me, but i don’t think it’s useful for me, to learn a language which has not a typical " popolarity " . I do not care for the salaries. :mad:
And i still don’t understand the difference between Ruby and Ruby on Rails.

Then you have not been reading carefully:

Ruby (the language) is often used with Rails (the framework). That combination is Ruby-on-Rails.

Perl was the predecessor of PHP (“and continues … today”). You should learn to use Perl.

1 Like

I didn’t insult you, I was replying to arout77.

However, do you believe that Python is better than Ruby?

arout77 has been clear that he believes there aren’t better languages than others. He gave good advice to learn multiple languages, with each one your idea of which is best will most likely change.

You would have a point there, if it weren’t for the fact that PHP was a clear upgrade over Perl as a web development tool.

Let me back up a second, because it seems like people are starting to get a little touchy (not you)…

First, just to make sure we address the OP’s question: learn either one, they are both great at what they were meant for. Whichever one feels “right” to him is what he should go for first…but once he is at a certain level in that language, it is imperative to also learn at least one of the other available options, whether it be Python, C#, MEAN, etc.

You and I had a back and forth regarding Ruby vs PHP…you never said “PHP sucks”, you were just implying that Ruby was better from a design standpoint. I would be a fool to disagree with that. However, the discussion really boils down to Rails vs PHP…in which case, since Rails is a web framework, to level the playing field, we’d have to either:

  1. Evaluate Ruby without RoR vs PHP, in which case PHP is clearly better for web development
  2. Evaluate RoR vs PHP using one of PHP’s better frameworks, like Zend, Laravel, Symfony or Yii

I assume we’re debating #2…and I honestly cannot see how anyone can recommend RoR over PHP + framework, other than simply personal preference. RoR is indeed just as good as the best PHP frameworks, so let’s call that a wash. But PHP has the added advantages of a massive and highly active community, which in itself is all the reason needed for a new developer to choose PHP, in my opinion. In addition, let’s be honest, for most people, PHP is going to be easier to learn. Then there is the practically universal support for PHP among web hosts, and many more career opportunities as a PHP developer.
Perfomance…that’s a wash. Ruby isn’t the slow turd that some people still think it is. But you won’t see any significant gain, if any at all, over PHP. There really isn’t a whole lot left to compare, other than Ruby has a nicer syntax (which is a highly subject thing, but most people would concur on that), and can usually do the same amount of work using a little less code, which means slightly faster development times.

So really, that’s my argument for PHP…Just as many features, just as fast, much larger and more active community, better support, more jobs, arguably (but generally accepted as) easier to learn.

Massive != Helpful

I don’t know Ruby, but the one thing I’ve noticed about it, and something you read almost every time you hear anyone mention it, is how great and wonderful the community is. This is actually one of the major reasons why Ruby has taken off so well is how helpful and open the community is.

Besides that, as long as you can find information on places like SO easily and find at least 1 or 2 people to help you when you have a problem, the community size should have no bearing on anything. Scala is a tiny community and the Play Framework is even smaller, but I never have a problem finding the information I need. If all else fails, there are plenty knowledgeable people on SO or if it’s not a good SO question, the Freenode channels are both very active.

You can run anything just about anything you want on a VPS. I rent my dev box for $5/mo and when my credit runs out I’m going to switch to one that performs better and runs $25/yr (different tech, but still a vps). You get startup cloud servers free until you grow to the point where you need to add more power, all of these support Ruby. Right now I’m running my next project on Heroku, it was originally designed as a Ruby host. (I’m working in Scala though) There are lots of other similar options as well and even AWS also does some free stuff, but I’m not experienced with it anything AWS because it frankly scared the crap out of me.

You shouldn’t consider anything on a shared host even remotely serious. Just because PHP can run on outdated shared hosts, doesn’t mean much. If you want to go another route, Python is installed by default on every single Linux distro that I know of.

My point is, support on “web hosts” is moot.

Well no… not really. Indeed lists PHP at almost 16,000 jobs. It lists Ruby at almost 12,000 jobs. Not a big difference. Indeed is kind of an aggregator, so it’s a pretty good resource for this kind of information.

Adding to that though, PHP is notoriously one of the lowest paid job markets out there. Mostly due to the very high amount of bad developers and the fact that a large majority of the jobs are for managing/building websites. Where as other techs that are used more in web applications tend to hire more developers at a higher rate. 1 PHP dev could manage 20 sites where as it could take 5 or 6 devs to run a single web application. This leads to more jobs.

A website is semi-static information that is used to put a face on something, like a Restaurant or maybe even a small online store. It could very well be running on a CMS, which is a Web App, but that doesn’t make it a web app itself. Web Apps are functional and interactive in one way or another.

The low pay can also be attributed to the very low entry bar for PHP. You can easily develop a pretty functional PHP website and still not really understand what you’re doing programmatically. PHP is one of the few places in Software Development where you can be a “PHP Developer” but not actually be a “Software Developer”. If you know Ruby or Python or Node.js or pretty much anything else, there is a very high chance that you probably know or could pick up any other kind of stack fairly easily.

Because of these things in this last point, I think that the “large community” and “low entry bar” for PHP is actually a very bad thing, rather than a positive.

And because of the things I said in this post, I flat out refuse to suggest PHP to new developers asking me things and try very hard to steer as far away from PHP as I possibly can. I feel like I am doing them a disservice if I don’t.

We’ll have to just agree to disagree with the point about the community. There are bountiful quality resources available for PHP…where the “massive” becomes a benefit is that more people and more resources means typically (or at least theoretically), you will get the help you need faster if you post on a message board. This place is a perfect example of that – look how dead this forum and Python is compared to PHP’s forum here.

Your point regarding Ruby typically being higher paying positions raises a question – are you talking about Ruby programmers, or Rails programmers? In my area, there seems to be a big distinction between the two, where Rails programmers do not make much more (if at all) than PHP devs, but Ruby programmers definitely make considerably more.
However, after further research, it appears that the amount of PHP jobs available over Rails isn’t quite as large as I thought, but if your numbers are accurate, we’re still talking about 33% difference…for every 100 PHP jobs, there are just 67 Ruby jobs…and surely, not all those Ruby jobs revolve around Rails.

And I stand corrected regarding web host compatibility. No respectable developer should be using $4/month shared hosting these days, so I recant my statement regarding that.

Ruby is Ruby on Rails. It could also be Sinatra or a few other frameworks. Not as popular, but still used. Sinatra has influenced a lot of things.

A framework isn’t a language, its just tools for a language. Most C# and about half the Java jobs you see posted are for web development, but they don’t specifically say anything about web because how you use it doesn’t matter if you know the language. (They might include buzzwords like “familiarity with RESTFUL technologies” or something though) Just like you’ll probably see more people advertising PHP, but actually use Laravel or Zend. The framework doesn’t really matter too much if you know the language.

A massive portion of business solutions with user interfaces are moving to the web. It makes more sense.

At my job, they actually use more PHP for scripting than web work. It was originally picked up as a replacement to Perl. Very few of the scripts actually have web interfaces. It might sound a little wonky, but it’s just a language, it does what it needs to do.


You still kinda sound like you’re thinking of languages designed for building Websites. Building a website in Ruby is silly, but building a webapp or a restful service is not.

Should have clarified; of course Rails isn’t a language, it’s a framework; what I meant was that at least in my area, when you see that a company is seeking a “RoR developer” for their website, the salaries they offer are inline with what PHP devs make. If they are hiring Ruby devs for other purposes, then yes, there is definitely a big bump in pay.

I am speaking in terms of web development; I am on the assumption that is what the OP is interested in since he is wondering about PHP as well…PHP sucks as a general scripting language, so in case you are not aware OP, if you are interested in more than just web development, then PHP is not an option. Learn either Ruby or Python (or both)

1 Like

This is why I think once you start considering using PHP Frameworks, then you’ve pushed PHP too far and you should consider something else. :smiley: Because at that point, it’s more than just a web page and starts becoming an application with a web interface.

There is no better language than PHP for something like:

<head><title>UNIX TIME!</title></head>
    <? echo "UTC:".time(); ?>

It’s a pretty amazing scripting language as I demonstrated above. No overhead for a little script you need to run on the web. Need to monitor some files on the server? Why not a single file PHP script to do it? Need to edit the file? PHP is great at that. No extra overhead, just a little 500 (max) line file and bam, you’re done.

It’s when you start needing to create a logical complex application with lots of moving pieces is when PHP starts falling apart.