Where does homebrew install a legacy php version?
Since PHP 8 is already installed, Homebrew won't link an earlier version of PHP to php.

Try brew link php@7.4
Otherwise access the Cellar directly: /usr/local/Cellar/php@7.4/*/bin/php