User Guide Cancel

ArrayResize

 

Description

Resets an array to a specified minimum number of elements. Resetting can improve performance, if used to size an array to its expected maximum. For more than 500 elements, use ArrayResize immediately after using the ArrayNew tag.ColdFusion arrays expand dynamically as data is added.

Returns

The updated array after resizing.

Category

Array functions

Function syntax

ArrayResize(array, size)

Parameters

Parameter

Description

array

Name of an array

size

Minimum array size

Example

<cfscript>
myArray=ArrayNew(1)
// Resize that array to the number of records
temp = arrayResize(myArray, 8)
writeDump(myArray)
</cfscript>
<cfscript> myArray=ArrayNew(1) // Resize that array to the number of records temp = arrayResize(myArray, 8) writeDump(myArray) </cfscript>
<cfscript>
    myArray=ArrayNew(1)
    // Resize that array to the number of records
    temp = arrayResize(myArray, 8)
    writeDump(myArray)
</cfscript>

Output

Get help faster and easier

New user?