Check php latest version here: http://php.net/downloads.php
=> Update your homebrew
$ brew update $ brew upgrade
=> Install a centralized repository for PHP-related brews: homebrew-php
* Yosemite, El Capitan, and Sierra. Untested everywhere else.
Run the following in your command-line:
$ brew tap homebrew/homebrew-php $ brew search php
will show you all php formula
We will Install php 7.1, because php 7.1.8 is the latest stable version till now (Aug 2017)
$ brew install php71
Check php version installed
$ php --version PHP 7.1.8 (cli) (built: Aug 7 2017 15:02:19) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
You are done.