| CFML Reference
|
|
ColdFusion Functions
|
ArrayAppend
Description
Appends an array index to an array. Returns a Boolean TRUE on successful completion.
Category
Array functions
Syntax
ArrayAppend(array, value)
See also
ArrayPrepend
Parameters
| Parameter |
Description |
array
|
Name of an array to which to append an index.
|
value
|
The value to place into an array in the last index position.
|
Example <!--- This example shows ArrayAppend --->
<html>
<head>
<title>ArrayAppend Example</title>
</head>
<body>
<H3>ArrayAppend Example</H3>
<cfquery name = "GetEmployeeNames" datasource = "cfsnippets">
SELECT FirstName, LastName FROM Employees
</cfquery>
<!--- create an array --->
<cfset myArray = ArrayNew(1)>
<!--- set element one to show where we are --->
<cfset myArray[1] = "Test Value">
<!--- loop through the query and append these names
successively to the last element --->
<CFLOOP query = "GetEmployeeNames">
<cfoutput>#ArrayAppend(myArray, "#FirstName# #LastName#")#
</cfoutput>, Array was appended<BR>
</CFLOOP>
<!--- show the resulting array as a list --->
<cfset myList = ArrayToList(myArray, ",")>
<!--- output the array as a list --->
<cfoutput>
<P>The contents of the array are as follows:
<P>#myList#
</cfoutput>
</body>
</html>
|
Copyright © 2001, Macromedia Inc. All rights reserved. |
|
|