Programming Languages war Python, PHP, Javascript (Nodejs) "Installation"

This post is a new series called Programming Languages war, I don't know which is better, but I'll try to figure it out. I hope y'all enjoy this series. Obviously We have to start the installation and amazing "Hello, World!". All series I'm going to use SO Ubuntu, then if you need support for other SO I'm going to be here to help you.

Python

It's easy. Why? Because ubuntu has python for default, Ubuntu 20.04 has python3.8 installed, then you can start to use this language without installing anything.

Now for executing one example obviously "Hello world" there are two ways, first, You can make a file with extension .py

hello.py

print("Hello, World")

and for executing you can run "python3 hello.py"

second way

You run "python3" for join into Python's console, and write print("Hello, World") and press Intro, for exit to the console you can press Ctrl+D

Both case you look the same result

"Hello, World"

PHP

Now it's time for the grandfather PHP, it's a joke, people think that PHP is older than python but not, well. We're going to install from scratch PHP, for this case I'm going to install PHP, by the way PHP is the most used language on the web.

For installing just execute "apt install php", the time of installation is fast, but depend on your connection of internet

Next, for use this language, there are two ways, console and browser. You can make a file with extension .php, but a difference python you have to use a syntax for PHP understands your code.

You have to define how to start and finish the file.

hello.php

<?php

echo "Hello, World";

?>

And for executing you can run "php hello.php"

Second ways

I told you that PHP is the most popular language for web, then if you want to see this message in browser, you have to run "php -S localhost:8000" where -S is a server, localhost is the IP local and 8000 is the port over run this server, So you can see the message, you should write in the browser "localhost:8000/hello.php". The command is important executing in the same folder where you save your file hello.php, for exit to the server you can press Ctrl+C

Both case you look the same result in the console and browser.

"Hello, World"

Javascript (Nodejs)

Javascript is last language in join for the competition in backend language, but it arrived for compete, before Javascript was only for the client side, but a brilliant mind said, if we use it to backend, or I think that’s how it went ;-). And created Nodejs is a JavaScript runtime built on Chrome's V8 JavaScript engine.

Now how start with Nodejs

For installs just execute "apt install nodejs", the time of installation is fast, but depend on your connection of internet.

We're going to execute one example Can you guess what? :D "Hello world" there are two ways, first, You can make a file with extension .js

hello.js

console.log("Hello, World")

And for executing you can run "node hello.js"

Second way

You run "node" for join into Node's console, and write console.log("Hello, World") and press Intro, to exit to the console you can press Ctrl+C two times.

Both case you look the same result

"Hello, World"

Conclusion

This is our first view about three languages, how you could see we can use any language in backend for the same things, but which is better, today we can see a few conclusions:

  • Python is shortest for both installation and syntax if you want to display a phrase.
  • PHP can show in browser without installing anything more.
  • Javascript runs on Nodejs on server environment.
  • PHP is larger because you have to define how start the file.

I hope you enjoy my post and remember that I am just a Dev like you!