Sometimes you need different PHP versions to run older scripts or work in older projects. If you have not yet installed XCode, please install the XCode Command Line Tools.
To install it, please open your terminal and run: Please check with the following command if brew has been successfully installed: Now you should see something like that: You should probably also run the following command to ensure everything is configured correctly: It will instruct you if you need to correct anything. Brew currently supports the following versions: 7.2, 7.3, 7.4 To install older versions you need to run the following command: Next, you can install all the PHP versions you need.
To check which PHP version is currently enabled you need to execute the following command: After a brew upgrade it can sometimes happen that some of the installed PHP versions do not work anymore because of missing dependencies.