Comparison between numbers and strings in PHP comparison operators in PHP is a bit odd and error-prone. the comparison rules are listed as follows:
1. when comparing the two characters in size, is the ASCII code size of the two characters compared ?? This article is easy to understand.
2. when two strings are compared in size, they start from the first character and compare the corresponding ASCII size, as long as they start from a corresponding position, the current position character of one string is greater than the corresponding position character of the other string, that is, the size of the two strings, such as 'BA'> 'Az '?? This article is actually known to all.
The comparison between '10' and 'A' is the same. first, compare '1' and 'A' ASCII codes, which are larger than 'A.
3. when a number is compared with a string/character, the system first tries to convert the string/character to an integer/floating point type and then compare it, for example, if '12bsd' is converted to 12 and 'A' is converted to 0, you must note that the corresponding ASCII code value is not compared with the number.
In fact, the result of 'A' + 10 is also 10.
Which is easy to ignore: 0 returns true if it is compared with any string that cannot be converted to a number (operator =.
The following result is displayed:
1 var_dump ('000000' <'a'); // result: boolean true2 var_dump ('A' <1); // result: boolean true3 var_dump (1 <'123'); // result: boolean true
Your own instance:
= 'Your Day');?>
Output result: boolean true
The Chinese character is first transcoded using Gbk or UTF-8. the Chinese character is converted to a letter at the underlying layer.