Checking if your code is running on 64-bit PHP

后端 未结 5 1243
梦如初夏
梦如初夏 2020-11-29 05:09

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 f

5条回答
  •  半阙折子戏
    2020-11-29 05:39

    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 http://php.net/manual/language.types.integer.php for more details.

提交回复
热议问题