Integer


Integers can be specified in decimal (base 10), hexadecimal (base 16) and octal (base 8), and binary (base 2) notation, optionally preceded by a sign (- or +).

To explicitly convert a value to integer, use either the (int) or (integer) casts and this is case-insensitive.

<?php
$octal = 010;                // 8 - base 8
$decimal = 10;               // 10 - base 10
$hexadecimal = 0x10;         // 16 - base 16
$binary = 0b10;              // 2 - base 2
$str_test = "10";            // string "10"
$int_test = (int)$str_test;  // convert string to integer
?>