To upgrade from PHP 7.0 to 7.1 on Homebrew you have to first inlink 7.0 and then install 7.1:
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:
brew update
and
brew upgrade
before you do all of the above. This so you have the latest Homebrew and formulas.