This brief tutorial walks you through the steps to switch between multiple PHP versions in Ubuntu Linux and its derivatives. This guide is officially tested on Ubuntu 18.04 LTS server edition. It may work on other older or newer Ubuntu versions as well.
Source: How To Switch Between Multiple PHP Versions In Ubuntu – OSTechNix