Max value for int

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

Max value for int

Post by tores »

Hi

What's the maximum value for an integer in PHP (WIN XP).
Is there a constant or function that returns this value?

regards tores
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

id imagine that a integer can be as long as you want it to be. why would there be a restriction?
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

Post by tores »

At some point a number will go from int to double... When does this happen?
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

Post by tores »

Code: Select all

define('MAXINT', 2147483647);
define('MININT', -2147483648);
An int spans from -2^31 ro 2^31-1. In php an int is made up from 32 bits where 1 bit is a sign bit.
Post Reply