This article mainly introduces the in_array function usage in php and analyzes the in_array function usage and related precautions in PHP in the form of examples. It has some reference value. If you need it, you can refer
This article mainly introduces the in_array function usage in php and analyzes the in_array function usage and related precautions in PHP in the form of examples. It has some reference value. If you need it, you can refer
This article analyzes the in_array function usage in php. Share it with you for your reference. The details are as follows:
PHP is a weak language. When using the IN_ARRAY function, try to include the third parameter. The Code is as follows:
The Code is as follows:
Var_dump (in_array (0, array ('s', 'ss'), true); // return false
Var_dump (in_array (0, array ('s', 'ss'); // return true
Var_dump (in_array (0, array (1, 2, 3); // return false
From the above three functions, we can see that when the first one is in_array (0, array ('s', 'ss'), true), the returned value is the value we want.
Usage:
The Code is as follows:
Var_dump (in_array (0, array ('s', 'ss ')));
And:
The Code is as follows:
Var_dump (in_array (0, array (1, 2, 3 )));
The returned ture is obviously not the value we need, because PHP is the weak type, so you should pay attention to it before.
I hope this article will help you with php programming.
,