null when empty).
Returns the remainder of an array or iterable after the first element has been removed. An array returns either a new array (or null if empty). A Generator returns a Generator that lazily yields every element after the first; an empty Generator source yields an empty Generator, not null.
/**
* @param iterable<int|string, mixed> $source
* @return array<int|string, mixed>|\Generator<int|string, mixed>|null
*/
Arrays\tail(iterable $source)This can be used to create a simple closure which can be used as a regular function.
var_dump(Arrays\tail(['a', 'b', 'c'])); // ['b', 'c']
var_dump(Arrays\tail(['only'])); // []
var_dump(Arrays\tail([])); // NULL
Accepts a Generator or any Traversable as input.
$gen = (function () { yield 'a'; yield 'b'; yield 'c'; })();
foreach (Arrays\tail($gen) as $v) echo $v; // bc