Usage:
update-my-alternatives --config php
Create this alias (preferably in .bashrc)
alias update-my-alternatives='update-alternatives --altdir ~/.local/etc/alternatives --admindir ~/.local/var/lib/alternatives'
If it does not already exist, make this directory:
~/.local/bin
Add this to your path, in front of everything else:
$HOME/.local/bin
Run this script
for VERSION in 7.4 8.0 8.1 8.2 8.3;do
update-my-alternatives --install $HOME/.local/bin/php php /usr/bin/php${VERSION} ${VERSION//./0}
done
Now should be able to run:
update-my-alternatives --config php