<cfscript>
oneDimensionArray = ArrayNew(1);
oneDimensionArray[1] = 1;
oneDimensionArray[2] = 'one';
oneDimensionArray[3] = '1';
</cfscript>
<cfif IsDefined("oneDimensionArray")>
<cfdump var="#oneDimensionArray#">
</cfif>
Result:
Also, we can declare an one Dimension Array as:
oneDimensionArray = [];
Alternatively, CF introduced WriteDump()
from CF9 as a function equivalent to the <cfdump>
tag which can be used in <cfscript>
.
<cfscript>
WriteDump(oneDimensionArray);
</cfscript>
<cfscript>
twoDimensionArray = ArrayNew(2);
twoDimensionArray[1][1] = 1;
twoDimensionArray[1][2] = 2;
twoDimensionArray[2][1] = 3;
twoDimensionArray[2][2] = 4;
</cfscript>
<cfdump var="#twoDimensionArray#">
Result: