Step 1: Install the Visual C++ Redistributable for Visual Studio 2015 from http://www.microsoft.com/en-us/download/details.aspx?id=48145 if not installed.
Step 2: Download preferred version of PHP for Windows from https://windows.php.net/download/
if preferred version not found in main download page then check past release page https://windows.php.net/downloads/releases/archives/
Here I am upgrading PHP 7 version:
chose version (7**) Non-thread-safe 32/64-bit
I am downloading the “php-7.3.21-nts-Win32-VC15-x64.zip” version as per my need.
Step 3: Once downloaded. Expand the zip file into the path C:\YOUR-XAMPP-FOLDER\php7**
Step 4: In the C:\YOUR-XAMPP-FOLDER\php7** folder, rename the file php.ini-development to php.ini, it may ask for administrator access, allow it.
Step 5: Edit the php.ini file in a text editor (e.g. Notepad++, Atom, or Sublime Text).
Step 6: Change the following settings in the file and save the file:
Change memory_limit from 128M to 2G (because Composer can use lots of memory!) (For Magento reference)
Uncomment the line that reads ; extension_dir = "ext"
Step 8: In the section where you find a bunch of extension= lines, uncomment the following required (For Magento reference) lines:
Note: if any package is not available in your XAMPP installation, install it separately.
Step 9: Add C:\YOUR-XAMPP-FOLDER\php7** to your Windows system path, so that this version of PHP is available globally:
Open the System Control Panel.
Click ‘Advanced System Settings’.
Click the ‘Environment Variables…’ button.
Click on the Path row under ‘System variables’, and click ‘Edit…’
Click ‘New’ and add the row C:\YOUR-XAMPP-FOLDER\php7**
Edit existing one and set entry from existing C:\YOUR-XAMPP-FOLDER\php7** to new C:\YOUR-XAMPP-FOLDER\php7**
Click OK for "Edit environment variable window",
then click OK for "Environment Variables window",
then click OK for "System Properties window",
and close the System Control Panel.
Step 10: restart XAMPP.
check the PHP version using “php -v”.
Hopefully it will help someone. If you have any questions, please comment out.