ArrayPush()
Adds an element at the end of an array and returns a new size of the array.
Introduced: 5.3.8.104
ArrayPush( array=array, value=any );
Returns: Numeric
| Argument | Description |
|---|---|
|
array
array,
required
|
edit
The array where an value/object is to be added. |
|
value
any,
required
|
edit
Element to be added at the end of an array |
Examples
editnumbers = [ 1, 2, 3, 4 ];
Dump( ArrayPush( numbers, 0 ) ); // Outputs 5
moreNumbers = [ 5, 6, 7, 8 ];
Dump( ArrayPush( moreNumbers, 4 ) ); // Outputs 5
See also
- Arrays
- array.push()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)