ARRAYSWAP  
Description

Swaps array values of an array at specified positions. This function is more efficient than multiple cfset tags.

 
Returns

True, on successful completion.

 
Category

Array functions

 
Function syntax
ArraySwap(array, position1, position2)
 
See also

"Functions for XML object management" in Chapter 35, "Using XML and WDDX," in ColdFusion MX Developer's Guide

 
Parameters

 
Example
<h3>ArraySwap Example</h3>

<cfset month = ArrayNew(1)>
<cfset month[1] = "February">
<cfset month[2] = "January">
<cfset temp = ArraySwap(month, 1, 2)>
<cfset temp = ArrayToList(month)>

<p>Show the results: <cfoutput>#temp#</cfoutput>

Name of an array

ARRAY  

Position of first element to swap

POSITION1  

Position of second element to swap

POSITION2