Usually the short_open_tag syndrome is the cause of this issue ie:
<? and ?> instead of <?php and ?>
You may also look at your firewall settings and allow the ports XAMPP uses access.
Open \xampp\apache\logs\error.log file in your text editor by dragging in the file and see if there are any clues at about the date and time you last tried to go to http://localhost
in case it is another issues.
Check in the XAMPP Control Panel if Apache and MySQL are running.
Reboot and try again to test for a Windows Service issue.
Another possible cause is a .htaccess file in your web root folder with syntax issues.
Clear your browser's cache (temporary Internet files) and do this often if you get 'weird or what' server errors when working with localhost URIs.