Chapter 2
From Phpmaniac
My First PHP Script
Hello world is the starting point for almost every programmer learning almost any language. Hello Worlds purpose is to get the programmer familiar with syntax of the language with the least amount possible problems.
- <?php
- print('Hello World!');
- ?>
This is one of the easiest PHP scripts you can make, it contains one function, which prints out “Hello World!”. Although this script not particularly useful in the real world, it contains the basic elements of a PHP script.
If we break this script down we can see the following:
- The open tag (<?php), which tells the interpreter to go into php mode.
- The function print, which prints “Hello World!” to the output device.
- The close tag (?>) which tells the interpreter to exit PHP mode.

