Install php72 on MacOS using brew

I found the solution.

Instead of installing php72 you must specify version like this [email protected].

brew unlink [your actual php version linked]
brew install [email protected]
brew link [email protected]

This worked for me

brew upgrade
brew unlink php71
brew install php72

then in your ~/.bash_profile

export PATH=/usr/local/Cellar/php\@7.2/7.2.26/bin/:$PATH

Installing PHP 7.2 on Mac using Homebrew

Check version

  php -v

check brew is up to date

  brew update

  brew upgrade

Unlink php version which is installed in the system

  brew unlink php71

Now final step to download**

  brew install php72

  export PATH=/usr/local/php5/bin:$PATH