Variables can store data of different types, and different data types can do different things.
PHP supports the following data types:
A string is a sequence of characters, like "Hello world!".
A string can be any text inside quotes. You can use single or double quotes:
<?php
$x = "Hello world!";
$y = 'Hello world!';
echo $x;
echo "<br>";
echo $y;
?>
An integer data type is a non-decimal number between -2,147,483,648 and 2,147,483,647.
Rules for integers :
<?php
$x = 123;
echo $x;
?>
A float (floating point number) is a number with a decimal point or a number in exponential form.
<?php
$x = 123.45;
echo $x;
?>
A Boolean represents two possible states: TRUE or FALSE.
$x = true;
$y = false;
Here are the rules for determine the "truth" of any value not already of the Boolean type:
Null is a special data type which can have only one value: NULL.
A variable of data type NULL is a variable that has no value assigned to it.
$my_var = null;
A variable that has been assigned NULL has the following properties:
The escape-sequence replacements are: