Re: Integer - boundary?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brian P. O'Donnell wrote:
""Gustav Wiberg"" <gustav@xxxxxxxxxxxxxx> wrote in message
news:024601c5b3be$77135140$0300a8c0@xxxxxxxxxxxxxx

----- Original Message -----
From: "Shaw, Chris - Accenture" <cshaw@xxxxxxxxxx>
To: "Gustav Wiberg" <gustav@xxxxxxxxxxxxxx>; "PHP General"
<php-general@xxxxxxxxxxxxx>
Sent: Wednesday, September 07, 2005 5:03 PM
Subject: RE:  Integer - boundary?




-----Original Message-----
From: Gustav Wiberg [mailto:gustav@xxxxxxxxxxxxxx]


Hi there!


What is the boundary for an integer?


seems to be a easy question, but I can't find it...

/G
http://www.varupiraten.se/



According to the manual,


"The size of an integer is platform-dependent, although a maximum value of
about two billion is the usual value (that's 32 bits signed). PHP does not
support unsigned integers."



************************

This message has been delivered to the Internet by the Revenue Internet
e-mail service

*************************


--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/91 - Release Date: 2005-09-06

Hi there!

Thanx!

Hm... I would rephrase my question.. Is it possible to get the maximum
integer-value that can be used?


Hi

Try this code to see what it is on your platform:

Brian

<?

// start with some number you are sure is an integer
// make it a really high number to lessen the execution time
$i = 2100000000;

// if you want to do it on the first try, allow it to run until finished
// it will almost certainly take more than 30 seconds
set_time_limit(0);

while(is_int($i))
{
$i++;
}

// then you have the first number that doesn't qualify as int (on your
platform)
print($i)

?>
or, easier, simply make this script:
<?php
echo PHP_INT_MAX;
?>

and you're done :P The maximum integer value is stored in PHP_INT_MAX as of 4.4.0 and PHP 5.0.5

before that, you had to use a way as the one Brian posted

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux