Skip to content

Instantly share code, notes, and snippets.

Last active February 4, 2022 19:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
php switching for taskfile
unlink_php() {
PHP_CURRENT=$(php -v | head -n 1 | cut -d " " -f 2 | cut -f1-2 -d".");
PHP_LATEST=$(ls /usr/local/Cellar/php | cut -f1-2 -d".");
echo "Your current PHP version is ${PHP_CURRENT}";
echo "The latest version of PHP installed is ${PHP_LATEST}";
echo "Unlinking PHP ${PHP_CURRENT}...";
if [ ${PHP_CURRENT} = ${PHP_LATEST} ]; then
brew unlink php
brew unlink php@${PHP_CURRENT}
php7() {
echo "Linking php 7.4..."
brew link php@7.4
php8() {
echo "Linking php 8"
brew link php@8.0
php81() {
echo "Linking php 8.1"
brew link php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment