arrayLen

Determines the number of elements in an array.
CF MX: this function can be used on child XML objects.

arrayLen(array) → returns numeric

Member Function Syntax

someArray.len()

Argument Reference

array array
Required

An array which to determine length

Compatibility

ColdFusion:

Version 3+ The member function cannot be called on literals

Links more information about arrayLen

Examples
Sample code invoking the arrayLen function

Uses the arrayLen function to get the total length of an array

numberArray = [1,2,3,4];
writeOutput(arrayLen(numberArray));

Expected Result: 4

CF 11+ Lucee 4.5+ Uses the len member function is the same as running arrayLen.

colorArray = ['Green','red','blue'];
writeOutput(colorArray.len());

Expected Result: 3

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub