Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Is my php server 64 bit?
<?php
// http://ideone.com/JWKIf
function is_64bit() {
$int = "9223372036854775807";
$int = intval($int);
if ($int == 9223372036854775807) {
/* 64bit */
return true;
} elseif ($int == 2147483647) {
/* 32bit */
return false;
} else {
/* error */
return "error";
}
}
$is_64bit = is_64bit();
if ($is_64bit === true)
echo 'This version of PHP is 64bit!';
elseif ($is_64bit == "error")
echo 'There was an unexpected error with the script.';
else
echo 'This version of PHP is 32bit...';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.