Skip to content
Advertisement

Why does in_array return false for this search?

Why does below code return false? It ought to return true.

JavaScript

Online code editor

Advertisement

Answer

I think you have misunderstood the “strict” argument. Eg.

JavaScript

However if you don’t pass a third argument or pass it false:

JavaScript

However in your case the strings don’t match even with loose ==:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement