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

ArrayIsDefined

Last update:
May 18, 2026

Description

Determines whether an array element is defined.

Returns

True, if the array element is defined (exists); false, otherwise.

Category

Function syntax

ArrayIsDefined(array, index)

See also

History

ColdFusion 8: Added this function.

Parameters

ParameterDescription
array
Name of a one-dimensional array, or the array name and indexes into higher-order dimensions of a multidimensional array.
index
Index of the element in a one-dimensional array, or the index of the element in the final dimension of a multidimensional array.

Usage

The index value of an element must be less than the length of the array.To test the existence of an element in a multidimensional array, specify all but the last dimension of the array in the first parameter.

Heading

<cfscript>
       myCities=["London","New York","Paris","Tokyo","Barcelona"];
       WriteOutput(ArrayIsDefined(myCities,4) & " | "); //returns True since index 4 exists in the array
       WriteOutput(ArrayIsDefined(myCities,6)); //returns False since index 6 does not exist in the array
</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