PHP - Simple Sampe Hello World Script Example


PHP - Simple Sampe Hello World Script Example
  Forums Index
      » Tutorial and Guides Forums
        » » PHP - Simple Sampe Hello World Script Example



PHP - Simple Sampe Hello World Script Example
Post Description:
Post Tags: php, simple, sampe, hello, world, script, example, tutorial, guides, howto, teach, learn, computer, programming, support
This Post Has Been Viewed 1215 Times Since Tue Jul 25, 2006 10:02 am Posted By stalionboy with 0 replies
PHP - Simple Sampe Hello World Script Example
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.
post picture

Step 2: Copy and paste the following code into the blank text editor:


     Code:
<?php
# my first php script
echo "Hello World!";
?>

post picture

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)

post picture

Step 4: Upload hello-world.php file to your website.

[This post sponsered by www.webune.com]
post picture


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.

Leave Your Comments
* Your Name

  * Your Email Address (Will Not Be Published)

* Your Comments


Add Picture To Comments
Yes No             upload
Receive Replies on my Comments
(An email will be sent to you when someone replies to your comments)

     




Comments and replies About PHP - Simple Sampe Hello World Script Example






(0) Comments