Make your own free website on Tripod.com

Visit the Official PHP Website

Search this Site

PHP Programming

By James N Hitz

The Statement Block

Organisation and execution is controlled in any code using statement blocks. A statement block is a set of command expressions grouped together and executed in one instance.

To create a statement block, enclose all the command expressions that constitute the statement block within curly brackets (braces) ie. { }. This is an example of a statement block:

{
  PHP statement 1;
  PHP statement 2;
  PHP statement 3;
}

There are several was of relaying the same information. The above statement block will of course mean the same if written as:

{ PHP statement 1;
  PHP statement 2;
  PHP statement 3; }

or:

		{
  PHP statement 1;
  PHP statement 2;
  PHP statement 3;
		}

or even:

{ PHP statement 1;  PHP statement 2;  PHP statement 3; }

The choice is yours. The one you choose depends on personal taste, your sense of organisation and your programming etiquette. I personally like the first method of writting statement blocks and most of the examples in this tutorial will adopt that approach... So What if I do... It's a free world... Is it?!

<< Introduction to Lesson 4 | Beyond the Statement Block >>

JamHitz Productions