Returns the last value of an array or iterable, or null if the source is empty. For a Generator the whole stream is consumed (there is no way to know the last value without doing so).
/**
* @param iterable<int|string, mixed> $source
* @return mixed The last value, or null if empty.
*/
Arrays\last(iterable $source)This can be used to create a simple closure which can be used as a regular function.
var_dump(Arrays\last(['a', 'b', 'c'])); // 'c'
var_dump(Arrays\last([])); // NULL