PHP TUTORIAL
In this chapter we will write our first PHP Hello world program. Go ahead and type the following codeInstallating Apache on Local Machine
<html> <body> <? echo "Hello World"; ?> </body> </html> |
If you have taken a commercial server, save this files at a place and then write http://yrdomain/whereyousavedfile/index.php. You sould see "Hello Word" on your browser.
This program does not do anything dramatic. In fact, you could have achieved that same result by writing simple HTML code. There was no need to write the PHP code here.
However, PHP can be programmed at the server side. We will develop some more code in the next few pages before you will be able to realize the benefits of PHP.
A thing about php syntax in this program. The PHP codes start with <? and ends with ?>In between these two tags we write some codes. These codes are not seen by a browser. These codes do not run on user machine. This code run on server machine. When the user opens index.php the html codes are visible to the user and its machine. When the php code starts the server takes control and gives to the user machine what it wants. In this case the echo statement sends out something to display on the client machine.
In the next few chapters we will develop some common programming constructs for PHP.