Phpin_array syntax. Var_dump (in_array (0, array (s); the result is bool (true ). Because in_array compares 0 and s, 0 is number, and s is string. according to the compar var_dump (in_array (0, array ('s') in manual of the php Tutorial '));
The result of this statement is bool (true ).
Because in_array compares 0 and 'S', 0 is the number type, and 'S' is the string type. according to the instructions in chapter "comparison operators" in the manual of the php Tutorial, number and string
During comparison, the string type is first converted to number before comparison. The result of converting 's' to number is 0, and the result of 0 = 0 is true, so in_array (0, array ('s', 'SS ')) the result is true.
If the third parameter strict of in_array is set to true, the system checks whether the value and type are equal during comparison. True is returned only when the values are equal. otherwise, false is returned.
Php in_array syntax
Bool in_array (mixed $ needle, array $ haystack [, bool $ strict]) returns either straight or false
Http://www.bkjia.com/PHPjc/447009.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/447009.htmlTechArticlevar_dump (in_array (0, array (s); the result of this sentence is bool (true ). Because in_array will compare 0 and s, 0 is of the number type, and s is of the string type, according to the compar...