Quantcast
Channel: Checking if your code is running on 64-bit PHP - Stack Overflow
Browsing latest articles
Browse All 5 View Live

Answer by naT erraT for Checking if your code is running on 64-bit PHP

Here is an example that can be used from consoleFor Windows:php -r "echo (PHP_INT_SIZE == 4 ? '32 bit' : '64 bit').PHP_EOL;"&& php -i | findstr ThreadFor Linuxphp -r "echo (PHP_INT_SIZE == 4 ?...

View Article



Answer by Chris0 for Checking if your code is running on 64-bit PHP

A short way to get the number of bits. strlen(decbin(~0));How this works:The bitwise complement operator, the tilde, ~, flips every bit.@see http://php.net/manual/en/language.operators.bitwise.phpUsing...

View Article

Answer by Tim Penner for Checking if your code is running on 64-bit PHP

You could write a function like this:function is_32bit(){ return PHP_INT_SIZE === 4;}Then you could use the sample code you posted:if ( is_32bit() ) { do_32bit_workaround();} else { do_everything_else();}

View Article

Answer by coreyward for Checking if your code is running on 64-bit PHP

Check the PHP_INT_SIZE constant. It'll vary based on the size of the register (i.e. 32-bit vs 64-bit).In 32-bit systems PHP_INT_SIZE should be 4, for 64-bit it should be 8.See...

View Article

Checking if your code is running on 64-bit PHP

Does anyone know of a way of checking within PHP if the script is running as either 32-bit or 64-bit? Currently I'm using PHP 5.3.5.Ideally I'd like to write a function so my code can look like...

View Article

Browsing latest articles
Browse All 5 View Live




Latest Images