Variable is just like a container for data. We can say we store data in variable. In PHP, there are two type of variable. Predefine variable(SuperGlobal Variable) and User define Variable.
1. SuperGlobal Variable:- This is predefine variable and these variables are automatically available to any PHP program. There is no need to declare and define these variable in the program.These are following type of SuperGlobal Variable.
When we send data through form tag by get method and send data through querystring , then we reterive data by this superglobal variable .
When we send data through form tag by post method then we reterive data by this superglobal variable.
We reterive cookies data through this superglobal variable.
We reterive session data through this superglobal variable.
When we use file browse html control then we reterive file name,type and size by this superglobal variable.
We reterive variables available from the server environment.
This superglobal contains the data that sent by get method, post method and query string.
This is an array variable that contain information about webserver such file path,etc.
we discuss each superglobal variable in details in next classes.
2. User define Variable:- This variable is declare and define by programmer
$num is a variable and 34 is a data and this data store in variable $num.
How to print variable data.
here echo statement print variable data.
echo "Number is $num";
Number is 34.