PYTHON vs PHP vs RUBY - 2021 Update

Which programming language should you learn in 2021? Python, PHP or Ruby?

Possibly the biggest question facing web development newbies is which language is best to learn for their future career and prospects. There are many programming languages to choose from and each has its own strengths and weaknesses. Possibly the most important concern is how long each language takes to learn and this varies for each language. So which should be learned for the best chance at a successful career in programming?

When I started to learn web development, I searched a lot about it but it made me incredibly confused. I could not find a definitive answer on which language was the best because different authors give different perspectives. Most authors were just comparing the languages without giving an overall conclusion.

Therefore, in this article I am going to compare three modern programming languages - PHP, Python, and Ruby by answering the following questions:

  • What are the strong points of the language?
  • What are other limitations of these languages?
  • Which language is the most secure?
  • What are the advantages and other supports for these languages?
  • What are the job/developer ratio and average salaries for developers?

I am not adding JavaScript in this article. I will compare javascript separately in a new article.

What are the strong points of the language?

Each programming language is surviving in the market because they have some kind of advantages and monopolies over other languages. In the past few decades, many programming languages have been extinct as they could not maintain any significant relevance.


Easy to learn and purely for web development!

Years ago in 2014 when I had started writing blog posts, I had highlighted PHP (version 4) as the worst language, but PHP 5 and PHP 7 made an incredible enhancement. 

From the beginning, PHP has a stronghold over the web development industry. Later new programming languages like Python and Ruby started to occupy space in web development. With the rise of NodeJs, space for PHP shanked. Before the Laravel, all PHP frameworks were outdated in comparison to the alternatives in the other programming languages. 

When I had learned Laravel in 2014, I found it totally immature against Django (Python). But now at the end of 2020, Laravel is too ahead of any of its competitors. If you are expecting your career in web development Larvel is the best choice for you.


Python is a general-purpose giant. I wonder what I can not do in Python. Android Development! If you are not sure which programming language you should learn then Python is for you. Or if you are intending to learn Machine Learning, Artificial Intelligence, or Data Science then ignoring Python is not an option. When I learned Python, I found it the easiest language. Even easier than PHP (back in 2013). I was coming from a Java and C++ background and working in Python was like a dream.

If Python is your first language then perfecting Python will take one to two months but if you are coming from C++ or Java, this will take less than two weeks. I like its syntax and weak typing. I am working on Django since 2016 as my company project. Scope in Python is unlimited.


Ruby is another general-purpose language. Ruby on Rails was my second web development framework after Laravel. I got only one project in Rails. Ruby syntax is simpler than Python (at least for me, I give different syntax for the different scope variables an advantage. This can be tricky for you). 

Despite being a general-purpose language, Ruby is still identified with Ruby on Rails (a web development framework). Learning Rails need a little bit of patience. You can learn Laravel (PHP) and Django (Python) within a week (if you have a good hold on the respective language and basic knowledge of web development, much better if coming from another framework).

The dependency of Ruby over Ruby on Rails has pushed it on the back foot. In web development, where PHP was already a dominant player and after NodeJs Javascript is killing the space, the scope for Ruby on Rails has sunk drastically. The rise of Java and Python has also created huge challenges for Ruby. I, personally, do not intend to spend much time following Ruby but there are people who still love and believe that Ruby is still 100% alive.

What are the limitations of these languages?

A fish can not fly that does not mean fish is worse than a bird.


  • Critics blame PHP syntax that is more like C/C++ and Perl, with lots of curly braces and dollar signs and "->". But I don't think after you learned this programming language, the syntax will bother you anymore.
  • The confused tableau of function names. The built-in library has a wide variety of naming conventions. Functions often have prefixes to denote their source (but often not). Functions are often placed into classes to simulate namespaces.


  • Python has no 'switch' statement and 'do ... while' construct
  • No increment and decrement and assignment operators
  • No ternary operator/statement (... ? ... : ...). Python provides an inline "if else" option. But I hate that syntax in my code.
  • No private, protected, and public modifiers for both properties and methods
  • No abstract and final modifiers for both classes and methods


  • Getting work is almost dependent on Ruby on Rails. This adds significant time to the learning phase.
  • Slower processing time (CPU time) compared to other programming languages

Which language is the most secure?

There is nothing on the internet that is 100% secure. The level of the website/application security depends primarily on the programmer, not on the programming language. Till PHP 5 (somehow PHP 5 too), PHP was well known as an unsecured language. But now this is not the case. 

If a programmer/developer does not make any errors, then no programming language is that much insecure that we have to consider it while selecting a programming language. 

For avoiding mistakes, good IDEs and proper tests are required. These all three languages have IDE and Testing (via frameworks) supports. 

Strong typing also reduces a lot of headaches. Ruby is a dynamic and strong typing language. Stong typing support since PHP 7 and Static typing in Python narrow this difference.

Although, I have never used Static typing in Python myself. I am much reliable on the tests.

As a result, there is not really a solid conclusion to be drawn from the question of security.

What are the advantages and other supports for these languages?


  • Easy for beginners to pick up. Easy to learn for developers coming from a similar syntax background like C, C++, C#, Java, Javascript, etc.
  • It supports all major web servers like Apache, Microsoft IIS, Netscape, personal webserver, iPlanet server, etc.
  • PHP has dominance in the web development industry.
  • During hosting, it is very easy to host PHP websites directly with no server configuration (not true for all frameworks). Hosting websites may be a headache for newbies to web hosting.
  • The Laravel framework in PHP is the most well known and have given good strength to PHP.
  • Easy to develop any CMS quickly.


  • Easy syntax and very readable. Easy to learn for those who have little or no experience with programming.
  • Dominant in Machine Learning, Artificial Intelligence, and Data Science.
  • General-purpose language.
  • Very object-oriented.
  • Python is much better suited as a "glue".
  • Huge standard library.
  • Great frameworks for web development like Django and Flask.


  • Ruby is an object-oriented language.
  • Ruby was developed to make a developer's work easy.
  • Mix-ins allow imported classes and modules to be extended and overridden by user code after it is imported. Classes are never closed in Ruby.
  • Powerful Ruby code blocks.
  • Everything returns a value (including things like 'if' statements). This makes it easy to write functional-like code and much easier to chain commands.
  • Plenty of gems make every task easy within a few efforts.
  • The power of ruby in web development is the Ruby on Rails framework. It is very magical. You need not be worried about the basic functionality of web development. You can focus more on the other complex algorithms.
  • Ruby gives programmers freedom and power.

What are the developers/jobs ratio and the average salary?

This is a very subjective question and can not have a simple general answer. This totally depends upon the skills of the developer/programmer.  High skill means a high salary, language does not matter that much. But high skills in Machine Learning, Data Science, and AI generally dominant over high skills in web development. Python has some upper hand in this regard but does not happen in all cases.

Overall conclusion:

Let's summarize all in short:

  • PHP and PYTHON are easy to learn for beginners. Ruby is also easy to learn but if you are learning it for Ruby on Rails, then the learning phase will be longer.
  • Currently, if you are looking for web development, then PHP is the most secure for a job followed by Python. In general, Python provides opportunities in more domains.
  • Python is best as a general-purpose language.
  • Larvel (PHP), Python (Django), and Ruby (Ruby on Rails) Frameworks are preferred more than other frameworks for web development.

You can choose any of them. If you are looking for a big goal, then Python is best with a lot of dominant features like Machine Learning. But all programming languages have their own scopes just like players in any game.

Further Readings:

  1. Django vs Laravel vs Ruby on rails
  2. Laravel Tutorials
  3. Learn building CMS from scratch with todo list demo in PHP and MySQL
  4. Simple blog application in Laravel 7

Programming tutorials:

  1. Step by step PHP tutorials
  2. Step by step python tutorials
  3. Step by step Ruby tutorials
  4. Step by step Java Tutorials

Click on banner below to Learn: PHP with Laravel for beginners - Become a Master in Laravel

About Harish Kumar

Harish, a technical core team member at with five year experience in full stack web and mobile development, spends most of his time on coding, reading, analysing and curiously following businesses environments. He is a non-graduate alumni from IIT Roorkee, Computer Science and frequently writes on both technical and business topics.

Related Articles

PHP stands for PHP: Hypertext Preprocessor. PHP is known as a server side scripting and interpreter language for web ...
Introduction to PHP
In this tutorial, we will study about conditional statements (if else statements and switch statements). These statem...
Conditional statements in php
In this tutorial, we will study about strings and operations upon strings. Due to long length of this section, I have...
Strings in PHP (part-1)

Full-Stack Web Development with React

Best Udemy Courses

Top Posts

Recent Posts

The Complete Web Developer Course - Build 25 Websites


Subscribe now and get weekly updates directly in your inbox!

Any Course on Udemy in $6 (INR 455)

Development Category (English)300x250