Guide to change your PHP version through the command line on Ubuntu
This is a guide to change your PHP version through the command line on Ubuntu 22.04
To list all the installed PHP versions on your local device, use the following command :
sudo update-alternatives --config php
To change your currently used PHP version to a different version (that is installed), you can use the following command:
sudo update-alternatives --set php /usr/bin/php${version}