Appends an element to the end of an array.
arrayAppend(array, value [, merge])
→ returns boolean
someArray.append(value [, merge])
false
true
false
Uses the arrayAppend function to append a value to the end of the array
someArray = [1,2,3];
arrayAppend(someArray, 4);
writeOutput(serializeJSON(someArray));
Expected Result: [1,2,3,4]
CF 11+ Lucee 4.5+ Invoking the append function on an array is the same as running arrayAppend.
someArray = [1,2,3];
someArray.append(4);
writeOutput(serializeJSON(someArray));
Expected Result: [1,2,3,4]
CF 10+ You can merge two arrays when third parameter is set to true.
someArray = [1,2,3];
ArrayAppend(someArray,[4,5,6],true);
writeDump(serializeJSON(someArray));
Expected Result: [1,2,3,4,5,6]
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.