How to deal with hexadecimal strings in PHP7
Specific questions: $T1 = 0x3FFFFFFF & (1 * (0xd5b42e11)); $T2 = 0x3FFFFFFF & (1 * ("0xd5b42e11")); var_dump ($T1)
The values of the above code for the following platforms in php7 (not included) are:
Int (364129809) int (364129809)
In php7, the value is:
Int (364129809) int (0)
Excuse me, in the php7 environment, how to deal with 0x.$str to make it the same as the above face value?
Solution:
Starting with PHP7, hexadecimal strings are no longer considered numbers
If you have to detect whether a string contains hexadecimal numbers, the officially recommended code is
In view of the above problems, it should be changed to
$T1 = 0x3FFFFFFF & (1 * (0xd5b42e11)); $T2 = 0x3FFFFFFF & (1 * (filter_var ("0xd5b42e11", FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX)); var_dump ($T1) Thank you for your reading, the above is the content of "how to deal with hexadecimal strings in PHP7". After the study of this article, I believe you have a deeper understanding of how to deal with hexadecimal strings in PHP7, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!