Custom Search

Monday, August 18, 2008

Basics of PHP

A PHP block always starts with < ? and ends with ?> .

Each line in PHP must end with a semicolon. There are two basic statements to output text one is echo and other one is print.

In PHP, we use // to make a single-line comment or /* and */ to make a large comment block.

Variables:

Variables are used for storing values, such as numbers, strings or function results. All variables in PHP start with a $ sign symbol.

A variable name must start with a letter or an underscore "_"
A variable name can only contain alpha-numeric characters and underscores (a-Z, 0-9, and _ )
A variable name should not contain spaces. If a variable name is more than one word, it should be separated with underscore ($my_variable), or with capitalization ($myVariable)

Examples: $txt = "Hello"; $num = 10;

  

No comments:

Powered By Blogger