Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the shaping range of 32-bit and 64-bit in PHP and MySql

Shulou Source: shulou.com Published: 2022-06-03 19:51:18 09月15日 Update

This article introduces the relevant knowledge of "what is the plastic surgery range of 32-bit and 64-bit in PHP and MySql". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

A byte has 8 bits, so the 32-bit int type occupies 32 bits / 8 bits = 4 bytes, and the 64-bit int type occupies 64 bits / 8 bits = 8 bytes.

32-bit, 64-bit unsigned integer maximum:

2 ^ 64-1 = 18446744073709551615

2 ^ 32-1 = 4294967295

32-bit, 64-bit signed integer maximum:

(2 ^ 32) / 2-1 = 2147483647

(2 ^ 64) / 2-1 = 9223372036854775807

Minus 1 is because the integer includes 0.

The value of 64-bit Ubuntu 14.04 PowerPoint inscribed Max is 9223372036854775807, which is the same as the maximum value of signed bigint in MySQL.

The value of 32-bit Ubuntu 14.04 is 2147483647, which is the same as the maximum value of signed int in MySQL.

Echo date ('Y-m-d echo date, PHP_INT_MAX); return 2038-01-19 11:14:07

Echo strtotime ('2038-01-19 1111 14 07'); return 2147483647

Echo strtotime ('2038-01-19 11 / 11 / 14 / 14 / 08'); null is returned under 32 bits

That is, the maximum time () of PHP on 32-bit systems can only return a timestamp of 2038-01-19 11:14:07.

Field type: `posted` int (10) unsigned NOT NULL DEFAULT'0'

On 32-bit MySQL (as well as 64-bit MySQL), inserting a number larger than the maximum of 32-bit unsigned int type 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 an 8-byte bigint type.

Data type

LP64

ILP64

LLP64

ILP32

LP32

Char

eight

eight

eight

eight

eight

Short

sixteen

sixteen

sixteen

sixteen

sixteen

_ int32

N/A

thirty-two

N/A

N/A

N/A

Int

thirty-two

sixty-four

thirty-two

thirty-two

sixteen

Long

sixty-four

sixty-four

thirty-two

thirty-two

thirty-two

Long long

N/A

N/A

sixty-four

N/A

N/A

Pointer

sixty-four

sixty-four

sixty-four

thirty-two

thirty-two

This is the end of the content of "what is the plastic surgery range of 32-bit and 64-bit in PHP and MySql". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Maximum maximum symbol byte type range content more knowledge utility achievement and then that is dilemma field actual situation data integer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology Linux Shulou Information OPPO Reno