brew unlink php70 brew install php71
Then you can check the version running on your Mac using;
php -v PHP 7.1.3 (cli) (built: Mar 28 2017 21:57:28) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
NB It is recommended to do a:
before you do all of the above. This so you have the latest Homebrew and formulas.