I've seen a lot of people do the former, is there any performance benefit doing one vs the other? Or is it just an eye candy? I personally use the latter every time as it is shorter and personally more readable to me.
feedback
|
The other responses focus on the differences between the two functions. This is true, but if the source array does not contain
Which gave me the following results: For a small array:
For a relative big array:
So if it's possible it's faster to use | |||||||
feedback
|
A much faster alternative to check whether a key exists in an array is to use | ||||
feedback
|
They both are different
whereas
| |||
feedback
|
| |||
feedback
|