How to encode a 64-bit integer into a network byte sequence?

Source: Internet
Author: User
Project requirements: encode a 64-bit integer into a network byte sequence. I know that pack (& #039; J & #039;, $ bigint) can be used in php5.6.3 and later versions ), but in this case, I have to disagree with the new php version. Now the company uses the php5.4.9 operating system as 64-bit linux. In this case, I would like to ask ,... project requirements: encode a 64-bit integer into a network byte sequence. I know that pack ('J', $ bigint) can be used in php5.6.3 or later versions ), however, I have to disagree with the new php version and O & M personnel. Now the company uses the php5.4.9 operating system as 64-bit linux. In this case, how to convert 64-bit integer codes

Reply content:

Project requirements: encode a 64-bit integer into a network byte sequence. I know that pack ('J', $ bigint) can be used in php5.6.3 or later versions ), however, I have to disagree with the new php version and O & M personnel. Now the company uses the php5.4.9 operating system as 64-bit linux. In this case, how to convert 64-bit integer codes

Pack ("NN", $ big> 32, $ big)

If you do not have built-in support, split it by yourself. It cannot be split into eight 8 bits in the correct order and then converted to bytes one by one.

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.