(Theoretically) You can install both PHP5 and PHP7 and switch between them.. If you only want PHP5, add the repo, install the packages for PHP 5.6 and end it there.

WARNING:
  • This leads to PhpMyAdmin not working if you install it afterwards..
  • Both versions working has not been tested in production.
  • If you check PHP version on system, php --version, it still shows PHP 7.0

add repo

There are no PHP 5.x packages in Zesty repositories. Only in the PPA, so you need to add the repo

sudo add-apt-repository ppa:ondrej/php
sudo apt update
NOTE: if you get
  sudo: add-apt-repository: command not found
then install the software-properties-common package. For my Ubuntu version (Precise Pangolin, 12.04 LTS), I also had to install the python-software-properties package:
  sudo apt-get install software-properties-common -y

install packages

# PHP 5.6
apt-get install php5.6 libapache2-mod-php5.6 php5.6-cli php5.6-common php5.6-curl php5.6-dev php5.6-gd php5.6-intl php5.6-mcrypt php5.6-mysql  php5.6-recode php5.6-xsl php5.6-pspell php5.6-ps php5.6-imagick php-pear -y

# PHP 7
apt-get install php7.0 libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-curl php7.0-dev php7.0-gd php7.0-intl php7.0-mcrypt php7.0-mysql php7.0-pspell php7.0-recode php7.0-xsl php-imagick php-pear -y

Switch PHP version ( Apache ):

from php5.6 to php7.0:

sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart

from php7.0 to php5.6:

sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart

enable modules

a2enmod rewrite
# phpenmod -v 5.6 mcrypt # PHP5
phpenmod -v 7.0 mcrypt # PHP7