Using phpinfo(), I have found that the installed version of PHP is 7.0.26. I want to upgrade it to PHP 7.2.
You have to install the PHP 7.2 (or any higher version 7.x) and remove your old version if you don't need it any more.
First add the PPA ppa:ondrej/php, run:
sudo add-apt-repository ppa:ondrej/php sudo apt update
Second install the version you need 7.2 in your case, run:
sudo apt install php7.2
Third if you want to remove your old existing version, run
sudo apt remove php7.0