note 88288 deleted from reserved.constants by cmb
| From: | cmb@php.net | Date: | Sat, 15 Aug 2015 11:20:46 +0000 |
| Subject: | note 88288 deleted from reserved.constants by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203351@lists.php.net to get a copy of this message | ||
Note Submitter: soywiz at gmail dot com
----
Another way to determine PHP_INT_MIN:
<?php
define('PHP_INT_MIN', ~PHP_INT_MAX);
?>
It should work always:
MAX for 8bit-signed: 01111111
MIN for 8bit-signed: 10000000
In 32 bits:
php -r"echo (int)base_convert(str_repeat('1', 31), 2, 10) - PHP_INT_MAX;"
0
<?php echo ~(int)base_convert(str_repeat('1', 31), 2, 10); ?>
-2147483648