Apparently there is no official PHP 7.1 available for Ubuntu 16.04, but according to this askubuntu.com post there is a reasonably trustworthy PPA: ppa:ondrej/php which allows the installation of PHP 7.1 (and multiple other versions).
sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2
sudo apt update
After install you can check the currently enabled version and switch to a different version with the following:
``` update-alternatives --config php There are 2 choices for the alternative php (providing /usr/bin/php).
Selection Path Priority Status