Thanks, that’s much cleaner than my manual linking and unlinking.
I added a little more magic for a noninteractive version. Here is a switch to 7.0 then back to 5.6:

[code]
$ php -version | head -1
PHP 5.6.23-2+deb.sury.org~xenial+1 (cli)
$ sudo update-alternatives –set php $(sudo update-alternatives –list php | grep “php7.0”)
update-alternatives: using /usr/bin/php7.0 to provide /usr/bin/php (php) in manual mode
$ php -version | head -1
PHP 7.0.8-3+deb.sury.org~xenial+1 (cli) ( NTS )
$ sudo update-alternatives –set php $(sudo update-alternatives –list php | grep “php5.6”)
update-alternatives: using /usr/bin/php5.6 to provide /usr/bin/php (php) in manual mode
$ php -version | head -1
PHP 5.6.23-2+deb.sury.org~xenial+1 (cli)
[/code]