PHP First script
How to run PHP script
Type your first PHP script in a text editor like Notepad or notepad++, Shown in the image below.
.png)
After writing the script save this file in a given location with .php extension.
C->WAMP->www->project (Project folder is created by user. )
Generally WAMP folder is there but you can changed that location on the time of installation then save this file in that location.
The extension of this script is .php
.png)
After saving the file colour of PHP syntax and text are different like that.
Now open your web browser like Google Chrome, Internet Explorer.
Type (localhost) in the address bar.
.png)
Your project folder shown below.
Clicks on your folder where the script is stored.
Search your file and click on this.
Now your output on your browser.
.png)
How to modify and run script
If you want to modify that script then open notepad++ and modify your script.
.png)
After editing the script save it (Ctrl + s) and refresh your browser.
.png)
Congratulation, your first script has been modified properly.
Example of first script
Let's create the first script of the php and save it with .php extension.
<?php echo "Welcome to the php
"; echo "PHP is a scripting language "; echo "
"; echo "It's easy to learn.
"; echo "Php is open source."; ?>
- Example
- Run
In the above example only echo statement are there that is used for printing the string or variable and br is an html tag, that is used for new line.