Tuesday, October 2, 2012

Variables and Constanta in PHP


Variables in PHP

       Variables are places to store data. In PHP, the variable has some rules, namely:

a. Variables beginning with a $ (dollar)
         Example: $ color, $ name, $ password

b. After a $ sign followed by character or an underscore sign (_)
         Example: $ color, $ _name

c. After the $ sign is not allowed to use the numbers first. Allowed if written after a letter or underscore (_).
         Example: $ color5

d. In writing the PHP variable should not be any punctuation

e. Writing PHP variables are case sensitive

Constanta in PHP

        The constanta is the place to store its data is fixed and can not be changed.

Defining constants:

             Define ('constantaname "," constantavalue ");

    Example:

             Define ("phi", "3:14");

No comments:

Post a Comment