In programming, there is such a thing as a data type that defines the set of valid values and operations on them.

For example, it can be integers or real numbers, strings of different lengths, and much more. PHP supports four scalar (Integer, Double, Boolean, String) and two mixed (Array, Object) data type. Consider some of them in detail.

Integer data type defines the set of integers with certain limitations in size. For example, on 32-bit platforms, the range is from -2147483648 to 2147483647 (Listing 4.5).

Listing 4.5. Variable of type Integer

‹?php

$dec_int_number = 5; // integer variable

echo 5 // output integer

?›

Data type Integer can be presented in different number systems: octal, decimal and hexadecimal (see Listing 4.6).

Listing 4.6. Integer variables in different number systems

<? Php

// In the decimal system, all three numbers are 317

$ oct_int_number = 0475; // Octal numbers begin with 0

$ dec_int_number = 317; // This record int number

$ hex_int_number = 0x13D // hexadecimal numbers begin with Oh

?>