append
TABLE OF CONTENTS
Add items to the end of an array
Definition
array[any] append(array[any] $array, any *$items)
Appends *$items to the end of $array and returns the resulting array.
Parameters
array $array
The array to be extended.
any *$items
Any amount of arguments of any type to be added to the end of the $array.
Returns
array
The array with $items appended to the end of $array.
Examples
Transformation
{
a: append(`[]`,`0`),
b: append(`[0]`,`"abc"`),
c: append(`[0, "abc"]`,`null`),
d: append(`[0, "abc", null]`,`[true, false]`),
e: append(`[0, "abc", null]`,`true`,`false`),
f: append(`1`,`[]`) // Error
}Result
{
"a": [0],
"b": [0, "abc"],
"c": [0, "abc", null],
"d": [0, "abc", null, [true, false]],
"e": [0, "abc", null, true, false]
}Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article