阅读(2295) (8)

Laravel 8 zip() {#collection-method}

2021-07-01 16:46:26 更新

zip 方法在与集合的值对应的索引处合并给定数组的值:

$collection = collect(['Chair', 'Desk']);

$zipped = $collection->zip([100, 200]);

$zipped->all();

// [['Chair', 100], ['Desk', 200]] >