ads

Wednesday, 9 March 2016

variables in PHP

PHP VARIABLES

All variables in PHP denoted by $ variables are designed with = operator with variable or left side & expression is right side.

Syntax:-         $variablename=value; 

      eg:-   $number=50;

  • Variables donot have types. A variable donot know in advance whether it will be use to store a nunber or string.

  • variable name start with letter and underscore.

  • A variable name can contain alpha numeric character and underscore(_)(A - Z).

  • All variables names are case sensitive.For eg:- $age and $Age both are different variables.

  • We donot have to tell PHP which datatype the variable is PHP automatically convert the variables to correct data type depend on its value in other language.Such as C,C++,Java. The programmer must declare the name & type of variable before using it.

Variables have a three types:-

  • Global variable

  • Local variable

  • Static variable

No comments:

Post a Comment