You can manage multiple PHP versions in Mac with MAMP by using the MAMP Pro version. MAMP Pro allows you to switch between different versions of PHP and Apache. To switch between versions, open MAMP Pro and go to the “Hosts” tab. Select the host you want to change the PHP version for and click the “PHP” tab. From there, you can select the version of PHP you want to use.
If you don't have MAMP Pro, you can still switch between different versions of PHP by changing the path variable. To do this, open the terminal and type the following command:
export PATH=/Applications/MAMP/bin/php/<php-version>/bin:$PATH
Replace with the version of PHP you want to use. For example, if you want to use PHP 7.2, the command would be:
export PATH=/Applications/MAMP/bin/php/php7.2.10/bin:$PATH
Once you have set the path variable, you can check the version of PHP you are using by typing the following command in the terminal:
php -v