Home Tutorial Php Phpbasics Tutorial PHP Integer Data Type


PHP Integer Data Type
Posted on: March 6, 2010 at 12:00 AM
In this PHP tutorial you will come to know about integer data type of PHP, range of this data type, automatic type conversion to float, and examples will illustrate these concepts

Learn PHP Integer Data type:

In PHP integers can be decimal which is a normal number we use in our daily life (base of this number system is 10), an octal number (base of this number system is 8), and hexadecimal (base of this number system is 16).

To denote an octal number in PHP use 0 before the number, and to denote a hexadecimal number use 0x before the number.

Maximum size of the integer data type is platform dependent. Usually the size of integer is 2 million in 32 bit platforms whereas 64 bit platform supports upto 9E18.

If a variable got more than the supported range of integer then it would be converted to float data type.

PHP Integer Data Type Example:



echo"\$a=";var_dump($a);echo "<br/>";


echo"\$a=";var_dump($a);echo "<br/>";


echo"\$a=";var_dump($a);echo "<br/>";


echo"\$a=";var_dump($a);echo "<br/>";

$a= 2147483647;

echo"\$a=";var_dump($a);echo "<br/>";

$a= 2147483648;

echo"\$a=";var_dump($a);echo "<br/>";





Related Tags for PHP Integer Data Type:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 6, 2010

Recommend the tutorial

Advertisements Advertisements