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.

Category

Function syntax

ArrayContains(array,object)

See also

Parameters

Parameter

Description

array

Array to search in.

object

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

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy