Friday, January 13, 2006

PHP Integer size

How to tell how big your php integers are:



<?php

$one = 1;
$big = 4294967297;

$mod = sprintf("%u", $big);

$a = ( $one == $mod ) ? 64 : 32;

echo $a. "\n";

?>


Tested on 32 and 64 bit builds of PHP 4.4.1 on Solaris 8 (SPARC).

No comments: