集合的 nth (4) 这个怎么理解呢?
$collection->nth(4); // ['a', 'e']nth
方法创建由每 n 个元素组成的一个新集合:
$collection = collect(['a', 'b', 'c', 'd', 'e', 'f']);
$collection->nth(4);
// ['a', 'e']
你可以选择传入一个偏移位置作为第二个参数:
$collection->nth(4, 1);
// ['b', 'f']
翻译漏了个字
隔
nth
方法创建由每隔 n 个元素组成的一个新集合