Convert signed integer to unsigned integer method in PHP

Source: Internet
Author: User

This article mainly introduced in PHP to convert signed integer to unsigned integer method, the conversion method is very simple, this article directly gives the conversion method, the need for friends can refer to the

In a short address project, the ID of the short address map of the six-bit character becomes a signed integer when the ID exceeds 2147483647, according to the mapping algorithm between the six-bit character and the ID.

The code is as follows:

ID > Six-bit character > 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

You need to convert a signed integer to an unsigned integral type: (float) sprintf ('%u ', $id)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.