阅读(2099) (11)

Laravel 8 shift() {#collection-method}

2021-07-01 15:42:05 更新

shift 方法移除并返回集合的第一个元素:

$collection = collect([1, 2, 3, 4, 5]);

$collection->shift();

// 1

$collection->all();

// [2, 3, 4, 5]