芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/vendor/azjezz/psl/src/Psl/Vec/slice.php
Vec(0, 1, 2, 3, 4, 5) * * Vec\slice([-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5], 5, 3) * => Vec(0, 1, 2) * * @template T * * @param iterable
$iterable Iterable to take the slice from * @param int<0, max> $start Start offset * @param null|int<0, max> $length Length (if not specified all remaining values from the array are used) * * @return list
*/ function slice(iterable $iterable, int $start, ?int $length = null): array { $result = []; if (0 === $length) { return $result; } $i = 0; foreach ($iterable as $value) { if ($i++ < $start) { continue; } $result[] = $value; if (null !== $length && $i >= $start + $length) { break; } } return $result; }