I'm reading this question as "I want other people on other networks to be able to access my server". If I got that wrong let me know.
1) check xampp\apache\conf\httpd.conf
and make sure the line that starts with Listen
dosen't include localhost or 127.0.0.1. If it does Apache is only listening on localhost, so it won't matter weather we forward ports correctly or not, Apache will only accept connections from 127.0.0.1. If it does contain an IP, change it to only contain the port (ex: Listen 80
)
2a) (if your VM uses NAT to share it's host's IP address) Find out the local IP of your VM. You can do this by running ipconfig in command prompt on the VM. Forward ports 80 and 443 to this IP in your virtualization software. The methods for doing this vary depending on what software you are using to run the VM. Once you have that, get the host IP by running ipconfig on the host. You will use this IP in step 3.
2b) (if your VM network is bridged with your host network). Find out the local IP of your VM. You can do this by running ipconfig in command prompt on the VM. You will use this IP in step 3.
3) Forward ports 80 and 443 on your router to the IP from step 2.
4) Your website should be accessible via your public IP now. You can find your public IP at whatismyip.host. Unfortunately if any of the IPs involved change, this will break. Also lots of home routers don't properly handle you trying to access your public IP from inside your network, so you may have to get off your own network see if it worked.
2a is always a pain in my experience, so if possible I would consider just configuring your VM to used bridged networking. Beware though, some virtualization software can't handle this if you are connected via WiFi, since WiFi expects a single mac address per client.
If this is to help you learn how to run your own server, more power too you. I would recommend starting with XAMPP running on a physical machine though, since it removes 1 layer of networking to think about. If this is to get a PHP site running for 0 cost, there are free places to host PHP/MySQL sites. Uptime is not great, but running of your home router isn't going to have great uptime either.