If you want to upgrade or change php version in xampp then follow the below steps:
Create a php file info.php using below mentioned code
<?php
phpinfo();
?>
Run the info.php, You can see current version of php.
Method 1:
To Change Version of php in xampp you need to Download Xampp with exact php Version you want to upgrade with.
In old Xampp folder rename php folder to php_old, Now copy php folder from New Xampp folder and paste it into an old Xampp folder.
Now restart the Xampp.
If you get Error shown below than you need to Copy apache folder from New Xampp folder and paste it into an old Xampp folder.
Now, start th Xampp, If you are still unable to start Xampp, Visit https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170 Download and install File shown below.
Method 2:
To Change Version of php in xampp you have to Uninstall old xampp from pc. Make sure you Have Backup of htdocs folder and datatabase.
Download Xampp with Version with exact php Version you want to upgrade with. Like here i want to upgrade php Version of 7.4.33, So I will download and install Xampp Version 7.4.33.
Install new Xampp.
Start Xampp. and Run info.php. Now you can see new upgraded version of php. Now if you want your older htdocs projects you can copy it in htdocs.