This article mainly introduces the method of converting signed integer to unsigned integer in PHP. The conversion method is very simple. This article directly gives the conversion method. Friends who need it can refer to it
In a short address project, according to the mutual mapping algorithm of six-digit characters and IDs, when the ID exceeds 2147483647, the ID mapped by the six-digit short address becomes a signed integer.
The code is as follows:
ID > six characters > mapping ID
ID: 2147483644 > TfffVQ > 2147483644
ID: 2147483645 > efffVQ > 2147483645
ID: 2147483646 > NfffVQ > 2147483646
ID: 2147483647 > ffffVQ > 2147483647
ID: 2147483648 > nnnnnu > -2147483648
ID: 2147483649 > dnnnnu > -2147483647
ID: 2147483650 > rnnnnu > -2147483646
Need to convert signed integer to unsigned integer: (float) sprintf('%u', $id)