Creates a self-returning array accumulator. Each call with a value appends it and returns a fresh compiler; calling with no argument returns the accumulated array.
/**
* @param mixed[] $inital Initial array contents.
* @return Closure
*/
Arrays\arrayCompiler(array $inital = []): ClosureThis can be used to create a simple closure which can be used as a regular function.
$compile = Arrays\arrayCompiler();
$compile = $compile('a');
$compile = $compile('b');
$compile = $compile('c');
var_dump($compile()); // ['a', 'b', 'c']This can be called inline using currying.
var_dump(Arrays\arrayCompiler()('a')('b')('c')()); // ['a', 'b', 'c']