Whatever message this page gives is out now! Go check it out!

ArrayContains

Last update:
May 18, 2026
Note:
As of ColdFusion (2021 release), CORBA has been removed. You can no longer use CORBA-related features, functions, and tags.

Description

Searches an array for the presence of a specified object. The function searches for simple objects such as strings and numbers or for complex objects such as structures. Simple object string searches are case-sensitive. This function does not support searches for COM and CORBA objects.

Returns

Yes, if the specified object exists in the array.

History

ColdFusion (2018 release): Changed parameter name elementToBeSearched to value.

Category

Function syntax

ArrayContains(array,value)

See also

Parameters

ParameterDescription
array
Array to search in.
value
Object to search for.

Example

<cfscript>
       myArray=[1,2,3,4,5];
       writeoutput(ArrayContains(myArray,3) & " | "); //returns True since 3 is a member of myArray
       writeoutput(ArrayContains(myArray,6)); //returns False since 6 is not a member of myArray
</cfscript>

Output

YES | NO

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page