Also, we should try to use = = = to replace = = (Of course, this is also appropriate according to the specific business logic) when we compare two values in the control structure.
Little brother to explain why
Var_dump (In_array (0, Array (' s '));
The result of this sentence is bool (true).
Because In_array will compare 0 and ' s ', 0 is the number type, ' s ' is a string type, and according to the instructions in the chapter "Comparison Operators" in PHP Manual, number and string are
When comparing, the string type is first converted to number, and then the comparison operation. The result of ' s ' conversion to number is 0, and the result of 0 = = 0 is true, so the result of In_array (0, Array (' s ', ' SS ')) is also true
If the third parameter of In_array is set to True, the comparison will determine whether the value and type are equal. Returns true if all are equal, otherwise returns false.
This is the only record.
The above describes the Arrayadapter PHP In_array function usage considerations, including the arrayadapter aspect of the content, I hope that the PHP tutorial interested in a friend helpful.