Creates a function which adds the defined values to the end of an array.
/**
* Returns a Closure for appending a value to an array.
*
* @param mixed $value
* @return Closure(array<int|string, mixed>):array<int|string, mixed>
*/
Arrays\append(mixed $value): ClosureWhen Arrays\append() is called, it returns the following Closure which can be used like a regular function.
/**
* @param array<int|string, mixed> $array
* @return array<int|string, mixed>
*/
$function (array $data): arrayThis can be used to create a simple closure which can be used as a regular function.
// Create the closure that adds 'a' to the end of an array.
$addA = Arrays\append('a');
// Called as a function.
var_dump($addA(['b', 'c'])); // ['b', 'c', 'a']This can be called inline using currying.
// Adds `a` to the end of an array
var_dump(Arrays\append('a')(['b', 'c'])); // ['b', 'c', 'a']