One byte has 8 bits, so the 32-bit int occupies 32-bit/8-bit = 4-byte, and 64-bit int uses 64-bit/8-bit = 8 bytes.
32-bit, 64-bit unsigned integer maximum value:
2^64-1 = 18446744073709551615
2^32-1 = 4294967295
32-bit, 64-bit signed integer maximum value:
(2^32)/2-1 = 2147483647
(2^64)/2-1 = 9223372036854775807
Minus 1 is because the integer consists of 0.
The value of the 64-bit Ubuntu 14.04,php_int_max is 9223372036854775807, as is the maximum value of the signed bigint type in MySQL.
The value of the 32-bit Ubuntu 14.04,php_int_max is 2147483647, as is the maximum value for a signed INT in MySQL.
echo Date (' y-m-d h:i:s ', Php_int_max); Back 2038-01-19 11:14:07
echo strtotime (' 2038-01-19 11:14:07 '); Return 2147483647
echo strtotime (' 2038-01-19 11:14:08 '); 32-bit return null
That is, the maximum time () of PHP on a 32-bit system can only return the timestamp of the 2038-01-19 11:14:07.
Field type: ' Posted ' int (a) unsigned not NULL DEFAULT ' 0 '
32-bit MySQL (64-bit MySQL is also the case), inserting a larger number than the 32-bit unsigned int maximum 2^32-1 = 4294967295 will cause an error:
UPDATE ' punbb ' pb_topics ' SET ' posted ' = ' 4294967296 ' WHERE ' pb_topics '. ' id ' = 1;
Warning: #1264 out of range value for column ' posted ' at row 1
However, MySQL can store 64-bit integers with a 8-byte bigint type.
Data type |
LP64 |
ILP64 |
LLP64 |
ILP32 |
LP32 |
Char |
8 |
8 |
8 |
8 |
8 |
Short |
16 |
16 |
16 |
16 |
16 |
_int32 |
N/A |
32 |
N/A |
N/A |
N/A |
Int |
32 |
64 |
32 |
32 |
16 |
Long |
64 |
64 |
32 |
32 |
32 |
Long Long |
N/A |
N/A |
64 |
N/A |
N/A |
Pointer |
64 |
64 |
64 |
32 |
32 |
The above content is a small series to introduce 32-bit and 64-bit plastic surgery range, I hope to help.