Created
December 9, 2012 18:45
-
-
Save clouddueling/4246442 to your computer and use it in GitHub Desktop.
Is my php server 64 bit?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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