1 Before you need
PHP is a server side Scripting Language. That's why you can't run php file directly from a web browser. In order to run php file you will need a Web Server. If you want to run php file on your computer then you have to install a Web server. There are many free Web Servers Available freely on the web. But to do your task easy, you can use XAMPP web Server. Because you can setup xampp within 2 minute. Before run php file Please See How to Setup XAMPP server on Windows/7/8/10
2 Run PHP file
After installing xampp click on Start button and then All Program find for the Apps XAMPP control panel. The apps will run. Find start button respect of Apache and mySQL. Start the apache and mySQL server by clicking start button. Find xampp folder in C drive. Create a folder "php" in the xampp directory. Then write test.php file using notepad++ or other text editing software. Save it with test.php
Now copy the test.php file into php folder that you have created sometimes ago.
The total path will be C:\xampp\htdocs\PHP\test.php
Then open a web browser type in address bar localhost/php/test.php, Then hit on the enter.
You are Done! You will See the output of test.php
To run another script, Just Open the test.php file with Notepad++ and replace with your new code and finally save it and run it with same procedure.