- Forums
- Tutorial And Guides
- Php - Simple Sampe Hello World Script Example For Beginners
This Page Contains information about Php - Simple Sampe Hello World Script Example For Beginners By stalionboy in category Tutorial And Guides with 0 Replies. [1402], Last Updated: Sat May 18, 2024
stalionboy
Tue Jul 25, 2006
0 Comments
2554 Visits
In this tutorial I will show you how to start writing your first PHP script.
First, its important that you have php. If you don't have php, we recommend you buy a php plan from our friends at www.webune.com they have great PHP hosting plans for your domain name or website.
Ok, that's all you need - PHP hosting. Once you know you have php, you can continue, otherwise, if you don't, this script will not work unless the script is parsed by PHP engine.
Step 1: Open your your favorite text editor. I will be using Microsoft Window's Notepad in my examples. But you can use any ascii text editor. Don't use text editors like Wordpad or Word.
Step 2: Copy and paste the following code into the blank text editor:
CODE:
<?php
# my first php script
echo "Hello World!";
?>
WHAT DO THESE LINE MEAN:LINE 1: <?php - This tells your Apache Server that you are starting a PHP script.
LINE 2: # my first phpe script - Whenever a line start with a #, it tells the server to ingore this command because is a comment. Comments are very important when creating scripts.
LINE 3: echo "Hello World!" - The echo tells your server to display Hello World! into your browser.
LINE 4: ?> - You must close your <?PHP tag. Just like HTML tags, you must close all your PHP tags.
Step 3: Save the file as "hello-world.php" (include the quotes if you are using Notepad)
Step 4: Upload hello-world.php file to your website.
[This post sponsered by www.webune.com][url=http://www.webune.com]
[/url]
Step 5: Open the file with your browser from your website.
SEE DEMO: http://www.webune.com/tutorials/hello-world/hello-world.php
Step 6: Done. You have now created your first PHP script
NEXT: The next tutorial will show you how to integrate the PHP script into and HTML document page.