'What's the difference in the install methods of composer?

There are two ways you can install composer on Ubuntu or any linux based system.

One is by using

sudo apt install composer

and another is by using the method mentioned here: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-18-04

What is the difference between these two install methods apart from the obvious that apt install will give me a very old version of composer?

And which one should be used/preferred?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source