View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > ArrayNew PreviousNext

ArrayNew

Creates an array of 1-3 dimensions. Index array elements with square brackets: [ ].

ColdFusion arrays expand dynamically as data is added.

An array

Array functions

ArrayNew(dimension)

Parameter

Description

dimension

Number of dimensions in new array.

1, 2, or 3

<h3>ArrayNew Example</h3>
<!--- Make an array --->
<cfset MyNewArray = ArrayNew(1)>
<!--- ArrayToList does not function properly if the Array is not initialized with
ArraySet ---> <cfset temp = ArraySet(MyNewArray, 1,6, "")> <!--- set some elements ---> <cfset MyNewArray[1] = "Sample Value"> <cfset MyNewArray[3] = "43"> <cfset MyNewArray[6] = "Another Value"> <!--- is it an array? ---> <cfoutput> <p>Is this an array? #IsArray(MyNewArray)# <p>It has #ArrayLen(MyNewArray)# elements. <p>Contents: #ArrayToList(MyNewArray)# <!--- the array has expanded dynamically to six elements with the use of ArraySet,
even though we only set three values ---> </cfoutput>

Contents > CFML Reference > ColdFusion Functions > ArrayNew PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


sjibben said on Mar 29, 2005 at 1:34 PM :
How do you find out how many dimensions an array has after it has been created?
jrunrandy said on Apr 7, 2005 at 2:11 PM :
I think that IsArray with the second argument might be what you are looking for. http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/funct122.htm

In general, you will get a better and quicker answer by posting questions like this to the online forums: http://webforums.macromedia.com/

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functa12.htm