SANGKRIT

PHP: Data Types: Integers

Integers are whole numbers. An integer is a number of the set Z = {…, -2, -1, 0, 1, 2, …}. Integers are written in decimal, hexadecimal (prefixed with 0x), and octal notation (prefixed with 0), and can include +/- signs. Size of any integer is platform-dependent. Unsigned integer are not supported in PHP.
Example:

<?php
$a = 1287; // decimal number
$a = -17; // a negative number
$a = 0128; // octal number which equivalent to 83 decimal
$a = 0x1A; // hexadecimal number which is equivalent to 26 decimal
?>

(Related Tutorials)

One thought on “PHP: Data Types: Integers”

Leave a Reply