List Contains Value | ARRAY_CONTAINS

Syntax

ARRAY_CONTAINS( [value], [search] )

Parameters

value
The array in which the search value is being searched for. If it is not an ARRAY, it will be coerced into one using the ARRAY method.

search
The search value that is being searched for.

Return Value

TRUE if SEARCH is within the VALUE. FALSE if SEARCH is not found in VALUE.

Description

Determines if a value is within an ARRAY.

Examples

ARRAY_CONTAINS([], 1) # returns FALSE
ARRAY_CONTAINS([10, 5, 3], 5) # returns TRUE
ARRAY_CONTAINS(["red", "yellow", "blue"], "red") # returns TRUE
ARRAY_CONTAINS(["red", "yellow", "blue"], "purple") # returns FALSE
ARRAY_CONTAINS([[1, 2, 3], [4, 5, 6], [7, 8, 9]], [7, 8, 9]) # returns TRUE
ARRAY_CONTAINS([[1, 2, 3], [4, 5, 6], [7, 8, 9]], [1, 2]) # returns FALSE
ARRAY_CONTAINS([["a" => 1]], ["a" => 1]) # returns TRUE
ARRAY_CONTAINS([["a" => 1]], ["a" => 2]) # returns FALSE
ARRAY_CONTAINS(null, 1) # returns FALSE
ARRAY_CONTAINS("a", "a") # returns TRUE