Are Apache and MySQL started - check by looking for the green running next to Apache and MySQL in the XAMPP Control Panel.
Look in the error log file - \xampp\apache\logs\error.log
Make sure your php script starts with <?php
Can you see the Welcome Page when you type http://localhost
in your browser?
What are you typing in your browser to access the php page that just gives code?
How are you trying to open the php file that just gives code?