An integer data type is a non-decimal number that ranges from -2,147,483,648 to 2,147,483,647.
Rules for integers:
- An integer must contain at least one digit.
- An integer cannot have a decimal point.
- An integer can be either positive or negative.
- Integers can be represented in decimal (base 10), hexadecimal (base 16), octal (base 8), or binary (base 2) notation.
In the following example, $x
is an integer. The PHP var_dump()
function will return its data type and value:
Example