Name

IsArray

Synopsis

                  
                  IsArray(value [, dimension])

Returns true if the value specified is an array. In addition, IsArray( ) can check to see if the array is a specified dimension (1, 2, or 3). Examples:

<cfset Form.MyFormVar = "This is a form variable">
<cfset URL.MyURLVar = "This is a URL variable">
<cfset Grades = ArrayNew(1)>
<cfset Grades[1] = 95>
<cfset Grades[2] = 93>
<cfset Grades[3] = 87>
<cfset Grades[4] = 100>
<cfset Grades[5] = 74>
   
<cfif IsArray(Form.MyFormVar)>
  Form.MyFormVar is an array!
<cfelseif IsArray(URL.MyURLVar)>
  URL.MyURLVar is an array!
<cfelseif IsArray(Grades)>
  Grades is an array!
<cfelse>
  No variables are arrays!
</cfif>

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.