Skip to main content

PHP Syntax

If you came from other programming languages like c/c++ and or Java, you will not have difficulty understanding PHP syntax as they have the same thing in common.

But unlike c/c++ or Java, PHP script is executed on the server and can be inserted within any HTML code and must start scripting block with <?php and end with ?>.

Below is an example of PHP file:

As you can see the “Hello World” is within the scripting block of <?php and ?>. If you sometimes see a block that starts with <? and end with ?>, this means that the shorthand support is enabled in the server.

But for compatibility, use the standard form (<?php).

At the end of the echo command there is a semicolon (;). This means that it is a separator used to separate its line of code from other line.

As of now this is the basic syntax of PHP. As we go on we will teach you on how to create PHP script one by one.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.