PHP DATA TYPE
Data type simply means store different type of data and its uses. In PHP there are 8 data types as follows.
#1 PHP String
String means group or sequence of characters. Ex Hello World!
You can store string inside PHP variable using single quotation or double quotation.
#2 PHP Integer
In this data type variable hold number without a decimal and its range is fixed between -2,147,483,648 and 2,147,483,647.
Here is some rule of Integer
- One digit required
- Number is positive or negative
- No decimal point
echo $sum=$a+$b; // output : 30
For an integer, you have don’t want to define this is an integer value you can use single quotation or double quotation mark PHP automatically get what datatype you want to use
The float is number with a decimal point like 10.50. In float value required decimal point and some number after point
var_dump(10.50); // Output : float(10.50)
The boolean mean true or false. other mean 1 or 0.
Boolean simply use testing condition. if the condition is true then do this else do this