Integer data type

Integer is one of the PHP Types.integer is a number of the sets. example Z = {..., -2, -1, 0, 1, 2, ...}.

<?php
$a = 1234; // decimal number
$a = -123; // a negative number
$a = 0123; // octal number (equivalent to 83 decimal)
$a = 0x1A; // hexadecimal number (equivalent to 26 decimal)
?>

The PHP integer have 4 type. The size of an integer is platform-dependent .That is decimal number, negative number,octal number,hexadecimal number . The decimal base is 10,hexadecimal base is 16 ,octal base notation is 8.

PHP integer is platform-dependent, maximum value we can use billion is the usual value that is 32 bits signed.integer literals ,decimal is [1-9][0-9]* | 0,hexadecimal is 0[xX][0-9a-fA-F]+,octal is 0[0-7]+,integer is [+-]?decimal | [+-]?hexadecimal | [+-]?octal.

Warning

If an invalid digit is given in an octal integer (i.e. 8 or 9), the rest of the number is ignored.

php - integer Example :


<?php
var_dump(01090); // 010 octal = 8 decimal
?>