Usually, with a fresh version of macOS Sierra, you get a PHP 5.6 installed.
You’ve got two options: brew or curl install
brew update && brew upgrade
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew unlink php56
brew install php70You might get an error if PHP 5.6 has not been installed by brew previously, but don't worry, you can simply continue
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0
You can replace 7.0 by 7.1 in the command above to get version 7.1 of PHP
If the output of php -v still doesn’t echoes the version 7, simply type this command to update your path, it should do the magic, as stated on php-osx.liip.ch website
Apparently, the env var might have changed depending on your environment.
If the one above doesn’t work, you may try (thanks Robert Borghesi for your comment) :
export PATH=”$(brew — prefix homebrew/php/php70)/bin:$PATH”