If you are using new version of xampp.
Try http://localhost/dashboard/phpinfo.php
Answer from Prosenjeet Paul on Stack OverflowIf you are using new version of xampp.
Try http://localhost/dashboard/phpinfo.php
Put this code in your root directory or htdocs folder of xampp:
<?php phpinfo(); ?>- Save it as phpinfo.php and point your browser to it (this could be http://localhost/phpinfo.php)
- Example: random image (Click Here)
Put this in your root directory:
<?php
phpinfo();
?>
Save it as phpinfo.php and point your browser to it (this could be http://localhost/phpinfo.php)
- More information (you can get much more information than just the version).
- Example (random image):

Try with command from terminal
sudo /opt/lampp/bin/php -v
Find PHP version on windows command line - Stack Overflow
php - How to check XAMPP's version on Windows? - Stack Overflow
How to check PHP version?
PHP Version confusion (OSX, XAMPP)
Videos
In command prompt type below
set PATH=%PATH%;C:\path\to\php
Where C:\path\to\php is the folder where your php.exe file is located. After this run
C:\>php -v
than you will see something like
PHP 7.3.6 (cli) (built: May 29 2019 12:11:00)
UPDATE:
If you find that when you restart your computer, this solution will not work anymore:
Set the Path like as following:
Step 1 - Click on the
Windowsicon

Step 2 - Click on the
Settingsicon

Step 3 - Click on
System

Step 4 - Click on
About

Step 5 - Click on
System info

Step 6 - Click on
Advanced system settings

Step 7 - Click on
Environment variables...

Step 8 - Select
Pathrow and then clickEdit

Step 9 - Click
Newand then clickBrowse, then in the next panel which will open you need to select the folder you want in thePath. For the initial premise of this guide i will add the folderC:\Users\NewFolderInPathNote: Replace your PHP installed path(e.g:
C:\Program Files\php) with the above path .

Step 10 - Click
OKand click everyOKbutton you will encounter to close every previous windows.

You just need to find out where is your PHP folder.
- If you are using XAMPP or WAMP then you will see a php folder.
- You just need to go into the php folder using your cmd using command
cd \xampp\php (FOR XAMPP)
cd \wamp\php (FOR WAMP)
- And then just type in this command
php -v
- Then you will see something like
PHP 5.6.11 (cli) (built: Jul 9 2015 20:55:40) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
Please note
This answer is not valid for new version of XAMPP.
First, you'll need to stop Apache from XAMPP. Then,
Go go cmd and switch to your XAMPP folder. For example, if your XAMPP folder is in C:\
C:\>cd C:\XAMPP
In this folder is a file named php-switch.bat, run from the command line. If not, you can also run php-switch.bat directly.
You'll see the version you are now on, and procedure to switch. For example, type 4 to switch PHP 4 then follow the procedure.

PHP 4 will install in your XAMPP\PHP directory and successfully switch. then re-enable the Apache.
The best method is to change the PHP settings in
/apache/conf/extra/httpd-xampp.conf
to reflect the new version of PHP you want to use
In my case I unpacked PHP5.4 to C:\XAMPPLITE\PHP5.4 and then updated key lines in this file such as:
SetEnv PHPRC "C:\\xampplite\\php5.4"
LoadFile "C:/xampplite/php5.4/php5ts.dll"
PHPINIDir "C:/xampplite/php5.4"
You also need to ensure that the correct version of php5apache2_2.dll is installed
To ensure this I copied the new version of php5apache2_2.dll to the Apache modules directory with a unique name, and then modified the configuration to match that:
copy php5.4\php5apache2_2.dll apache\modules\php5apache2_2-5_4.dll
and in the httpd-xampp.conf file
LoadModule php5_module modules/php5apache2_2-5_4.dll
Open XAMPP Control Panel, hit on the "Help" button and then "View ReadMe" ... It'll open a Notepad file having the first line as:
"###### ApacheFriends XAMPP Version x.y.x ######"
where x.y.z is the XAMPP version!
Go to uninstall software if you are on windows and there you will see the version of your xammp.
