Hello Friends! In this tutorial I will teach you what is a variable and what is its type. This tutorial is in URDU/HINDI. In this tutorial I explained that a variable is a container which can hold any type of data. As other languages like C, C++ or Java we have to explicitly declare the variable and type of variable before we have to use it. But in PHP you simply create or make a variable by keep in mind the naming conventions and rules for declaring variables and PHP make a variable of that type which data you set or initialize in that variable. I also explained here that we cannot make or give any name to the variable, there are some predefined rules for giving the name of the variable. They are as follows:
A PHP variable starts with a $ symbol followed by a variable name.
You cannot start a variable name with a number or a special character. So every variable name should start with an alphabet character or a underscore. Such as $Employname, $_price,
Variable names are case sensitive so that $myage and $MyAge and myAge are different variables in PHP.
Every variable name can contain an alphanumeric data or numbers or underscore.
Further PHP provides different types of variables they are as follows:
Integer: Integer value can contain non-decimal values (numbers which have no decimal inside). It must contain at least one digit. It can be either positive value or negative value too.
The PHP range of integer value is: -2,147,483,648 and 2,147,483,647
Float: Float value can contain numbers having decimal inside or it can be represented in exponential form. For example 13.26 or 9658.321
Boolean: Boolean value consists of only two states as zero or one or true or false. Normally its contain TRUE or FASLE values. It is used in condition check.
String: As discussed above a string data contains a sequence of characters such as “Welcome to PHP”. When you assign a string value to a variable you will write in double quotes.
Object: Object type holds data and information and their processing information inside one place.
I hope that you like my tutorial and enjoy. Thanks for watching my video.