Chapter 2: ColdFusion Functions
ArrayClear
Deletes all data in the specified array. Returns a Boolean TRUE on successful
completion.
See also ArrayDeleteAt.
Syntax
ArrayClear( array )
array
Name of the array in which you want to delete data.
Example
<!--- This example shows ArrayClear --->
<HTML>
<HEAD>
<TITLE>ArrayClear Example</TITLE>
</HEAD>
<BODY>
<H3>ArrayClear Example</H3>
<!--- create a new array --->
<CFSET MyArray = ArrayNew(1)>
<!--- populate an element or two --->
<CFSET MyArray[1] = "Test">
<CFSET MyArray[2] = "Other Test">
<!--- output the contents of the array --->
<P>Your array contents are:
<CFOUTPUT>#ArrayToList(MyArray)#</CFOUTPUT>
<!--- check if the array is empty --->
<P>Is the array empty?:
<CFOUTPUT>#ArrayIsEmpty(MyArray)#</CFOUTPUT>
<P>Now, clear the array:
<!--- now clear the array --->
<CFSET Temp = ArrayClear(MyArray)>
<!--- check if the array is empty --->
<P>Is the array empty?:
<CFOUTPUT>#ArrayIsEmpty(MyArray)#</CFOUTPUT>
</BODY>
</HTML>
257
Need help?
Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?
Questions and answers