PHP is a very easy language to learn and to use. In this simple tutorial I will show you how to create a PHP script that display's
"Hello World".
Lets Start
1) First open notepad
2) Add this line to your the top:
This line lets the web server know that you are executing PHP and to execute this before displaying the HTML.
3) Next we will use the
Echo function to display our text, Hello World. Alternativly you could use the
Print function as well.
Add this below <?php:
PHP Code:
echo "Hello World!";
4) To finish our script we need to tell the server that we have reached the end of our PHP execution code. Add this line:
5) Save your file as hello.php and upload it to your webserver. Goto your website url (
http://www.yourwebsite.com) and add /hello.php (
http://www.yourwebsite.com/hello.php and you should see:
Hello World!
I've attached the sample file.