arraySwap
Description
Swaps array values of an array at specified positions. This function is more efficient than multiple cfset tags.
Categories
Syntax
ArraySwap(array, position1, position2)
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| array | Name of an array | ||
| position1 | Position of first element to swap | ||
| position2 | Position of second element to swap |
Returns
True,
on successful completion.
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)> Show the results: <cfoutput>#temp#</cfoutput>