Questions about "0 xFFFFFFFF" and 0xFFFFFFFF in php7

Source: Internet
Author: User
{Code ...} the value of the above Code on the platforms below php7 (not included) is: {code ...} the value in PHP 7 is: {code ...} how can I handle 0x in the PHP 7 environment. $ str make it the same as the nominal value?
$t1 = 0x3FFFFFFF & (1 * (0xd5b42e11));$t2 = 0x3FFFFFFF & (1 * ("0xd5b42e11"));var_dump($t1,$t2);

The value of the above Code on the php7 (not included) platform is:

int(364129809)int(364129809)

The value in PHP 7 is:

int(364129809)int(0)

What should I do in the php7 environment?0x. $ strSo that it is the same as the nominal value?

Reply content:
$t1 = 0x3FFFFFFF & (1 * (0xd5b42e11));$t2 = 0x3FFFFFFF & (1 * ("0xd5b42e11"));var_dump($t1,$t2);

The value of the above Code on the php7 (not included) platform is:

int(364129809)int(364129809)

The value in PHP 7 is:

int(364129809)int(0)

What should I do in the php7 environment?0x. $ strSo that it is the same as the nominal value?

Starting from PHP7, The hexadecimal string is no longer considered a number.
If you want to check whether the string contains hexadecimal numbers, the officially recommended code is


  

For your problem, you should change it

$t1 = 0x3FFFFFFF & (1 * (0xd5b42e11));$t2 = 0x3FFFFFFF & (1 * (filter_var("0xd5b42e11", FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)));var_dump($t1,$t2);

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.