About Lesson
PHP gives automatic data type conversion.
For example, if you provide an integer value to a variable, the type of that variable will automatically be an integer. Next, if you provide a string to the same variable, the type will change to a string.
Integers
It is a number without any decimal part.
Following functions are used to check if the type of a variable is integer:
- is_int()
- is_integer()
- is_long()
Example:
<?php $a = 100; $b = -150; ?>
Float
It is a number with a decimal point or a number in the exponential pattern.
Following functions are used to check if the type of a variable is float:
- is_float()
- is_double()
Example:
<?php $a = 21.9; $b = -15.351; ?>
NaN
NaN stands for Not a Number.
The following function is used to check if a value is not a number.
- is_nan()