Skip to content

Instantly share code, notes, and snippets.

@clouddueling
Created December 9, 2012 18:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save clouddueling/4246442 to your computer and use it in GitHub Desktop.
Save clouddueling/4246442 to your computer and use it in GitHub Desktop.
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