PHP introduction, code delimiters, comments and statements

Website Theme

PHP introduction, code delimiters, comments and statements

September 18th, 2006

Introduction

PHP Hypertext Preprocessor (PHP) is the most popular server-side scripting language on the world wide web. This guide is designed to introduce programmers familiar with other programming languages to PHP.

This guide will take the form of a series of posts that will cover PHP from the basics to intermediate level. In this post I will cover code delimiters, comments and PHP statements.

How PHP code is executed

PHP is an interpreted language. PHP code is placed in simple text files usually having .php extension. PHP code can also be placed alongside HTML code in the same file. This is one of the strongest features of PHP. PHP code is diffrentiated from the rest of the HTML code by the delimitation used.

Delimiting PHP code

PHP code is place within the <?php and ?> delimiters. See the example given below

[geshi lang=php]

[/geshi]

Commenting PHP code

Comments are used to annotate code. Any code that is placed inside a comment is ignored by the interpreter. Placing comments is a good idea because it helps other programmers follow your logic and also serves as a reminder to yourself of the same.

PHP has two types of comments similar to C++ comments. Single line comments begin // and end at the end of a line. Multiline comments begin with /* and end with */ . Examples of single line and multiline comments are given below

[geshi lang=php]

[/geshi]

PHP code statements

A code statement is a single PHP operation such as assigning a value to a variable. PHP code statements end with a semi colon. For ex:

[geshi lang=php]

[/geshi]

Thats all for now. I will cover more PHP coding topics in this blog in the future.

Comments are closed.

Domain for sale

This domain name is for sale. If you are interested in buying it please contact me.