Share on Google+Share on Google+

PHP Integer Data Type

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/>";






Posted on: March 6, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.