Home Yellow Pages Movies Classifieds Jokes Jobs Free Hosting Videos




Your First PHP Program

Now you know what is PHP. Lets start creating our first PHP program.

PHP Programs are just text files. You can create your PHP script in any ASCII text editor like Windows Notepad.exe or Edit Plus. Do not use Rich Text editor like MS Word, MS Write or Page Maker. I recommend using Edit+ available at www.EditPlus.com

All PHP Program file names should end with .php

Example: first_program.php, test.php

To create your first PHP Program, start your Text Editor and create a new file, put following content

<HTML>
<HEAD>
<TITLE> My First PHP Program </TITLE>
</HEAD>
<BODY>

<?php

echo "Hello World";

?>

</BODY>
</HTML>

Save the file as test.php

Now you have your first PHP Program ready to run. PHP is a server side program. So to run it, you need to upload it to your web server and call it.

http://your-web-server/test.php

If you are running on local web server, put the file in web servers DocumentRoot and access it through web server like

http://localhost/test.php

The program will show "Hello World" on the browser.

Let's Look into the code

Every PHP script start with <?php and end with ?>

echo command is used to print string "Hello World" to browser.

All PHP command ends with a semicolon ( ; )

Back to Home
BizHat.com   Bookmark   Astrology   Chat Room   Classifieds   Computer   Downloads   Directory   Dating   Domain Tools   Education   eCards   Finance   Forums   Freelance Work   Free Hosting   Free Mail   Gallery   Games   Guest Book   Greeting Cards   Ham Radio   Health   Home Business   Hosting Tutorials   Hosting Directory   India   Jobs   Jokes   Kerala   Matrimonial   Music   Movies   News   News Letter   Recipes   Real Estate   Search   SMS   Tourist Guide   Top 100 Sites   Vote Us   Yellow Pages   Arthunkal Church   Site Map  

Google