The full form of PHP is a Hypertext preprocessor. It was developed by Rasmus Lerdorf. It is a programming language for developing dynamic web applications and interactive websites. It is a server-side scripting language. It is used for establishing a connection between the front-end and database i.e., back-end.
Ways to run a PHP program:
Generally, we need a web browser to run a PHP program.
Write code in notepad.
Save the file with any name followed by a .php extension.
For example, Geeksforgeeks.php.
Save the file in the XAMPP location of the file structure.
If the XAMPP is installed in local disk C, then we have to save the file in C:\xampp\htdocs.
Like this we have to save the PHP file
After saving your code file into the htdocs folder follow the below steps.
Open XAMPP control panel.
Start Apache and MySQL servers
Go to any browser and type localhost/filename.php in the search box.
If you save your PHP code in a subfolder in htdocs, then type localhost/subfolder_name/filename.php
A PHP code can be written in 3 ways
Without any HTML markups
Embedding HTML markups in PHP code
Embedding PHP code in HTML.
1. Without any HTML markups:
PHP
<?php$a=10;$b=10;$c=$a+$b;echo("The addition of a and b is ".$c);?>
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.