阅读(2281) (0)

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]] >