If you want to know the PHP version you are running through the command line, you need to just type in the command the following line.
php -v
It will give you the current php version of your system which is currently using and output of PHP version like this (not exactly, depends on your version)
PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies