Variables are the container which store values to be used later in the program.

It is a loosely typed language. We can define variables at any part of our program. There is no need to define every variable at the top of document. Moreover, data types are inter-convertible as per the values assigned to them. An example will explain everything :-


$var = 10;
if (some cond){
  // do something
// some more code
$var2 = 99; // new variables defined at bottom
$var2 = "Hello World !!"; // data type changed 

Name of the variables must start with a character or an underscore (_). It can only contain alphabets and numbers(a-z, A-Z, 0-9)

No spaces are allowed between a variable name

Lets have some idea of string variables :-

Member Login

Member Login

Not a Member? Sign Up!

Login to comment

Be the first to comment on this topic


<<< Wanna review

Continue >>>