If you want to remove any installed version of PHP completely from the Ubuntu or Debian based Linux operating system then simply use the below command:
sudo apt-get purge 'php*'
to completely remove some particular version, mention that version in the above command:
The below command will purge or remove all PHP files related to 7.2
sudo apt-get purge 'php7.2*'
In the same way:
sudo apt-get purge 'php7.0*'
sudo apt-get purge 'php5.6*'