How to run PHP programs in XAMPP: PHP code can be written in any editor like notepad, notepad++, sublime text. After writing the PHP code, you need to save the program inside htdocs folder of XAMPP.
For example, I have created one filename called first.php and saved it inside htdocs folder.
I am using Windows operating system and installed XAMPP inside C drive. So the path of htdocs is “C:\xampp\htdocs”.
PHP programs run on web browsers like Google Chrome, Mozilla Firefox, Microsoft Edge. Below are some steps needed to be run PHP program using XAMPP.
Step 1: Create a simple program like firsh.php
<?php echo "<h3>First program from XAMPP</h3>"; ?>
Note: PHP statements ends with semicolon (;).
Step 2: Save the PHP program into htdocs folder inside xampp.
Step 3: Start XAMPP control panel and Apache webserver.
Step 4: Now, open your web browser and type localhost http://localhost/first.php on your browser window.
Step 5: Output of the above program will be shown as screenshot below.