Unless it has to be absolutely and definitely XAMPP, you can try to get what you want with WAMP. WAMP is pretty much the same thing in different package.
Once you have it installed, you can just switch between php versions here:
You can install as many versions of PHP as you need.
Here's how it is done in detail.
Just go here: WAMP download
Then select your base server, e.g. latest with php7.
Then, when WAMP 3 is installed, go to folder: addons and select php version (or versions) you are after. They offer php flavors starting from php 5.3.29, which should work with mysql_connect.
To install addon, during installation (double click exe file) just point to folder where you have your WAMP 3 installed.
Then you can use content of other folders, like: applications etc. to add more functionality
Everything's interfaced, so you can concentrate on coding and not hacking your environment.