First of all, we must understand what these languages are and used for, so below is a short introduction:
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 one is a data-based language that will be manipulating 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 categories all of these languages in to:
- Programming languages
- 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:
- 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.
<script> alert( 'Hello, world!' ); </script>
“Hello World” in PHP
<?php echo "Hello World!"; ?>
“Hello World” in Ruby
puts' Hello World!'
“Hello World” in Python
Php is also Objected Oriented.
Ruby is pure Object Oriented means it does not have a functional or Procedural paradigm.
Python is also Objected Oriented.
Below are a few examples.
<script> var x = 5; var y = 6; var z = x + y; </script>
<?php $txt = "Hello world!"; $x = 5; $y = 10.5; ?>
var1 = 5; var2 = '2'
x = 5 y = "John" print(x) print(y)
- 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 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 has these loops:
- While Loops
- Until Loops
- Do/While Loops
- For Loops
- Conditionals Within Loops
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.
This was just 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 are going to refer to is SQL stands for Structured Query Language, which basically 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.
Hey guys! It’s me, Marcel, aka Maschi. I earn a full-time income online and on MaschiTuts I gladly share with you guys how I stay on top of the game! I run several highly profitable blogs & websites and love to speak about these project whenever I get a chance to do so. I do this full-time and wholeheartedly. In fact, the moment I stopped working an 8-to-5 job and finally got into online business as a digital entrepreneur, is problably one of the best decisions I ever took in my life. And I would like to make sure that YOU can get on this path as well! Don’t let anyone tell you that this can’t be done. Sky’s the limit, really…as long as you BELIEVE in it! And it all starts right here..at Maschituts!