First PHP Script

Hello World php

This is the most common thing you do when you learning PHP. first and foremost you need to know that php blocks starts with . Similar to Html Hello Which makes Text bold like this Hello. Php blocks can be placed anywhere in your Web documents, aslong as your your php file is .php extension.

Let's create our first php file. Open test editor such as Notepad.. or any other web editor programs such as dreamweaver. but avoid using MS word for god sake... duh!
Now write the following document.

By the way.. codes above are in gif image format! Just because i don't want you to copy and paste codes in your text editor, you need to type everything yourself.

Save this file as "hello.php" and upload or place it in your testing folder or your web sever.
To execute this script, type something like this in your browser address bar :

http://www.yoursite.com/testfolder/hello.php
or if it's in your local site :
http://localhost/testfolder/hello.php


Adding comments on the Code

Adding comments on your php code is a good habit, this way you'll always keep track of bugs & errors that continue to show up all the time in developers browser.

Go on test it.. you'll not see those comment lines or blocks on the code.
This comment lines are commonly used by all php developers, because it reduces the complexity of the code. Imagine 1000 lines of php code without comments on it.. it would be difficult task for developers to locate the bugs.. with comments on it, it is easy to figure out, what went wrong.

Well that's it, we will talk about if and else statements on next chapter.