By right when using Homebrew, we can install multiple different versions of PHP at the same time but only use it one version at a time. To see which PHP version you have installed do run the command below and if you see it's ticked ✔︎ then it means it's installed.
brew search php
By default PHP version on Homebrew is "[email protected]", "[email protected]" and "php" which means that the PHP that has no version number is the latest / highest version, in this current time of writing is version 8.0.
Changing PHP Version
To switch to the PHP version you can simply do run the command below. Switching from PHP version 7.4 to 7.3.
brew unlink [email protected] brew install [email protected] brew link [email protected] php -v
brew unlink [email protected] brew link php php -v
Warning when switching
Sometimes there will be a warning while switching mentioning that linking should use "force" and if that's the case do use the flag option.
brew link php --force