Home>Article>Backend Development> Scared to think about it? About the third parameter of in_array

Scared to think about it? About the third parameter of in_array

藏色散人
藏色散人 forward
2022-07-15 13:52:35 2413browse

Usein_array ()Determine whether there is a certain value in the array. If the third parameter is omitted, sometimes the result may be meaningless...

For example, the following Code snippet:


      

Changed toin_array('Hello', $arr, true)This problem can be solved

This problem does not exist in JS, for example, use The indexOf () function can be rewritten like this

Scared to think about it? About the third parameter of in_array

I don’t know if this question will make you fall into silence→_→

Related recommendations: "PHP video tutorial

The above is the detailed content of Scared to think about it? About the third parameter of in_array. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete