We can assign different type of data to a variable. Data type means the various type of data that we assign to a variable.
PHP support various type of data type and all are also different from each other.
Below are the list of data type :
A string can have letters, numbers, special characters and arithmetic values or combination of all.
<!DOCTYPE html>
<html>
<body>
<?php
$a = "Hello world!";
$b = 'Hello world!';
echo $a;
echo "<br>";
echo $b;
?>
</body>
</html>
You can use both single quotation or double quotation
All the number without decimal point is called as integer.
Example: 100, 2000 etc.
<!DOCTYPE html>
<html>
<body>
<?php
$a = 100;
var_dump($a);
?>
</body>
</html>
The Float or Double data type are number with decimal point.
Example: 29.6, 30.03 etc..
<!DOCTYPE html>
<html>
<body>
<?php
$a = 29.6;
var_dump($a);
?>
</body>
</html>
A variable of type null is a variable without any data.
<!DOCTYPE html>
<html>
<body>
<?php
$a= NULL;
var_dump($a);
?>
</body>
</html>