$t1 = 0x3FFFFFFF & (1 * (0xd5b42e11));$t2 = 0x3FFFFFFF & (1 * ("0xd5b42e11"));var_dump($t1,$t2);
The above code in PHP7 (not included) the following platform values are:
int(364129809)int(364129809)
and the value in PHP7 is:
int(364129809)int(0)
Ask, in PHP7 environment, how should handle 0x. $str make it the same as the face value?
Reply content:
$t1 = 0x3FFFFFFF & (1 * (0xd5b42e11));$t2 = 0x3FFFFFFF & (1 * ("0xd5b42e11"));var_dump($t1,$t2);
The above code in PHP7 (not included) the following platform values are:
int(364129809)int(364129809)
and the value in PHP7 is:
int(364129809)int(0)
Ask, in PHP7 environment, how should handle 0x. $str make it the same as the face value?
PHP7 begins with a hexadecimal string that is no longer considered a number
If you do not want to detect whether a string contains hexadecimal digits, the official recommended code is
Your problem should be changed to
$t1 = 0x3FFFFFFF & (1 * (0xd5b42e11));$t2 = 0x3FFFFFFF & (1 * (filter_var("0xd5b42e11", FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)));var_dump($t1,$t2);