in_array() / array_search()
Does a value exist in the array?
Syntax
in_array($value, $arr)
Description
in_array returns true/false, while array_search returns the position (or false if not found).
Example
Loading editor…
Expected output
exists
When to use?
Membership check (is it selected, is it allowed?).