Skip to Content

Which is the odd one out? JS, PHP, Ruby, Python, MySQL

Which is the odd one out? JS, PHP, Ruby, Python, MySQL

Today, we will shed light on the topic “Which one of these is the least like the others?, when the possible choices are Javascript, PHP, Ruby, Python, and MySQL.

Let’s dive right in. 

 

Which one of these is the least like the others? JavaScript, PHP, Ruby, Python MySQL

MySQL is the least like the others as it is a database manipulation language, whereas PHP, Ruby, and Python are programming languages. 

 

 

How JavaScript, PHP, Python, and MYSQL are used

First of all, we must understand what these languages are and are used for, so below is a short introduction:

  • JavaScript: JavaScript is a client-side programming language mostly used for the web, but now Node.js JavaScript runtime environment can allow server-side programming, so JavaScript can be used both as a client-side as well as server-side programming language.
  • PHP: PHP is a server-side programming language mostly used for the web.
  • Ruby: Ruby is a general-purpose programming language, but it is challenging to learn.
  • Python: Python is also a general-purpose programming language, but it is easy to learn.
  • MYSQL: It is an open-source relational database management system that uses SQL language for manipulating data in databases.

From this basic introduction, the first four seem to be programming languages and related whatsoever. On the other hand, the fifth is a data-based language that will manipulate data directly in the databases.

PHP can be used along with SQL, but SQL will be required. So, based on these facts so far, we can categorize all of these languages into:

  1. Programming languages
  2. Database manipulation language

 

1. Programming languages

What are programming languages? Programming languages are those computer languages that can instruct a machine to do something useful.

We are familiar with C, C++, or Java as some of the famous programming languages used for Computer Programming but those are not the only programming languages.

In fact, there are a lot of others. With the advent of the Operating System, one became able to extend the functionality by writing independent apps:

This concept has been extended to other software, e.g., nowadays, not only apps can be developed for an operating system, but apps can be developed for almost any app.

What does this mean? Let’s take Microsoft Word. It has some awesome features, but we might want our specific features implemented per our needs.

Although we cannot get the app’s source code, we can extend this app functionality by writing an “Add on” for the app, with which we can extend the functionality.

This is true for almost all apps these days.

The languages we are referring to in this article are related to the web mostly:

  • JavaScript is used for client-side and server-side programming of a Web.
  • Php is mostly used for server-side programming for Web development.
  • Ruby is a general-purpose language that can be used for machine learning and some web apps.
  • The same is the case for Python.

These four are programming languages and have some similarities, but there are differences concerning their features and syntax. Let’s try to look at a few of these differences.

 

1. Syntax

The classical “Hello World” Program in JavaScript is as follows.

In JavaScript “Hello World” looks like the following:

 

<script>
alert( 'Hello, world!' );
  </script>

 

“Hello World” in PHP

 

<?php
echo "Hello World!";
?>

 

“Hello World” in Ruby

 

puts' Hello World!'

 

“Hello World” in Python

 

print('Hello, World!')

 

We can see that the general syntax of JavaScript and PHP is somewhat matching, and the same is the case for Ruby and Python.

 

2. Object Orientation

JavaScript is object-oriented.

PHP is also object-oriented.

Ruby is purely object-oriented, which means it does not have a functional or procedural paradigm.

Python is also object-oriented.

 

3.Variable Declaration

JavaScript, PHP, Ruby, and Python do not explicitly mention the data type as in C or C++. Examples are int, float, and char. However, the data type is auto-determined from the data assigned to the variable.

Below are a few examples.

 

JavaScript

 

<script>
var x = 5;
var y = 6;
var z = x + y;
</script>

 

PHP

 

<?php
$txt = "Hello world!";
$x = 5;
$y = 10.5;
?>

 

Ruby

 

var1 = 5;  
var2 = '2'

 

Python

 

x = 5
y = "John"
print(x)
print(y)

 

4. Loops

JavaScript

JavaScript has these loops:

  • for – loops through a block of code several times
  • for/in – loops through the properties of an object
  • for/of – loops through the values of an iterable object
  • while – loops through a block of code while a specified condition is true
  • do/while – also loops through a block of code while a specified condition is true.

PHP

PHP has the following loops:

  • while – loops through a block of code as long as the specified condition is true
  • do-while – loops through a block of code once, and then repeats the loop as long as the specified condition is true
  • for – loops through a block of code a specified number of times
  • foreach – loops through a block of code for each element in an array

 

Ruby

Ruby has these loops:

  • While Loops
  • Until Loops
  • Do/While Loops
  • For Loops
  • Conditionals Within Loops

Python

Python has as loops:

  • For loop, but it’s different than other languages For loops.
  • The range() function To loop through a set of code a specified number of times, we can use the range() function. The range() function returns a sequence of numbers, starting from 0 by default, increments by 1 (by default), and ends at a specified number.
  • else in for-loop, The else keyword in a for loop specifies a block of code to be executed when the loop is finished.
  • The pass Statement for loops cannot be empty, but if you, for some reason, have a for loop with no content, put in the pass statement to avoid getting an error.

We have just tried to compare the languages JavaScript, PHP, Ruby, and Python, which we put in our first programming languages category.

This was to show that there could be some syntax or feature differences, but all are programming languages.

They may also be different in case of the intended use, like one may be used for the web or some other purpose.

Let’s now have a look at the database languages.

 

Database manipulation languages

We have mentioned “MySQL” in this article and categorized it in the second category.

It is an open-source relational database management system that uses SQL language for manipulating data in databases.

The language we will refer to is SQL stands for Structured Query Language, which works with Databases that may be for any platform like MySQL, SQL Server, MS Access, Oracle, Sybase, Informix, Postgres, and other database systems. SQL language can be used with written statements to:

  • To create tables in a database.
  • To create columns, also called fields.
  • To populate data against the fields called rows or tuples.
  • To create relationships among different tables or entities.
  • To produce different reports and much more.

If we summarize today’s article, we looked into “Which one of these is the most different? JavaScript, Php, Ruby, Python MySQL” and concluded that the languages JavaScript, Php, Ruby, and Python could be categorized in one category and that “MySQL” has the biggest difference to the others.