Data types define what information is stored
The most used of them are:
Type | Description | Example |
numeric | Whole or floating point number. | $var = 5; $var = 2.45; |
---|---|---|
string | Sequence of symbols (text). | $var = 'PHP is awesome!'; |
boolean | Can have only 2 values - true or false . |
$var = true; |
It's done using echo
.
The variables are used to store data of certain type.
Their value can be changed any time.
Example of variables definitions: