# PHP int

This tutorial will teach you about the PHP int type, which represents integers in PHP.

Whole numbers such as -3, -2, -1, 0, 1, 2, 3… are examples of integers. In PHP, integers are represented by the int type.

The integer range is determined by the platform on which PHP is run. Integers typically have a range of -2,147,438,648 to 2,147,483,647. It is equivalent to 32 signed bits.

The PHP INT SIZE constant is used to determine the size of an integer. You can also get the minimum and maximum integer values by using the PHP INT MIN and PHP INT MAX constants.

In PHP, integer literals are represented in decimal, octal, binary, and hexadecimal formats.

### Decimal numbers

To represent decimal values, PHP employs a sequence of digits with no leading zeros. The sequence can begin with a plus or minus sign. If it lacks a sign, the integer is positive. For instance:

2000 -100 12345

From PHP 7.4, you can use the underscores (_) to group digits in an integer to make it easier to read. For example, instead of using the following number:

1000000

To group digits, use underscores (_) like this:

1_000_000

### Octal numbers

Octal numbers are made up of a leading zero and a series of digits ranging from 0 to 7. Octal numbers, like decimal numbers, can have a plus (+) or minus (-) sign. As an example:

+010 // decimal 8

### Hexadecimal numbers

Hexadecimal numbers are made up of a leading 0x followed by a series of digits (0-9) or letters (A-F). Lowercase or uppercase letters may be used. Letters are always written in uppercase.

Hexadecimal numbers, like decimal numbers, can include a sign, either plus (+) or minus (-). (-). As an example:

0x10 // decimal 16 0xFF // decimal 255

### Binary numbers

Binary numbers begin with 0b and are followed by the digits 0 and 1. A sign can be included in binary numbers. As an example:

0b10 // decimal 2

## is_int() function in PHP

The built-in function is_int() returns true if a value (or variable) is an integer. If not, it returns false. As an example:

$amount = 100; echo is_int($amount);

**Output**

1