PHPackages                             mucts/collections - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mucts/collections

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mucts/collections
=================

Subtree split of the Array Collections component.

1.0.1(5y ago)061MITPHPPHP ^7.4

Since Aug 16Pushed 5y agoCompare

[ Source](https://github.com/mucts/collections)[ Packagist](https://packagist.org/packages/mucts/collections)[ RSS](/packages/mucts-collections/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (3)Used By (1)

[![](https://camo.githubusercontent.com/e27473a2cc76c25e71f47614427ff9e36425423a903be0290741a035ed26d42b/68747470733a2f2f696d616765732e6d756374732e636f6d2f696d6167652f6578705f6465665f77686974652e706e67)](https://camo.githubusercontent.com/e27473a2cc76c25e71f47614427ff9e36425423a903be0290741a035ed26d42b/68747470733a2f2f696d616765732e6d756374732e636f6d2f696d6167652f6578705f6465665f77686974652e706e67)

 [![Build Status](https://camo.githubusercontent.com/ff91c285ac4d45352c97d03cb0cec509713e299983df187bb8b2e35c96349014/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d756374732f636f6c6c656374696f6e732f6261646765732f6275696c642e706e67)](https://scrutinizer-ci.com/g/mucts/collections) [![Code Intelligence Status](https://camo.githubusercontent.com/42eff305ac16e4174d57605ecc9edf719c8f9340f39bf0092c91a67f5f54c1e1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d756374732f636f6c6c656374696f6e732f6261646765732f636f64652d696e74656c6c6967656e63652e737667)](https://scrutinizer-ci.com/g/mucts/collections) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/565875fe8d5f3283d26e781caec2fd6ff802d270e8d8bc7a771e5fb3c24329b1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d756374732f636f6c6c656374696f6e732f6261646765732f7175616c6974792d73636f72652e706e67)](https://scrutinizer-ci.com/g/mucts/collections) [![Total Downloads](https://camo.githubusercontent.com/dcafa992196d18a4f88e49846eed7d2463f3add0ca4d7efa1b853f8077fdd80b/68747470733a2f2f706f7365722e707567782e6f72672f6d756374732f636f6c6c656374696f6e732f642f746f74616c2e737667)](https://packagist.org/packages/mucts/collections) [![Latest Stable Version](https://camo.githubusercontent.com/0d39b44ed192c5abc3df197f5d6c145702b4282d3b96b673ea6848df96b5effc/68747470733a2f2f706f7365722e707567782e6f72672f6d756374732f636f6c6c656374696f6e732f762f737461626c652e737667)](https://packagist.org/packages/mucts/collections) [![License](https://camo.githubusercontent.com/1432626594b588ca4083ef79cc5e87a5431a4a0e21a1cabb8265424668467dfb/68747470733a2f2f706f7365722e707567782e6f72672f6d756374732f636f6c6c656374696f6e732f6c6963656e73652e737667)](https://packagist.org/packages/mucts/collections)

Collection
==========

[](#collection)

> `Collection`类提供一个便捷的操作数组的封装。

创建一个新的集合
--------

[](#创建一个新的集合)

一个集合可以使用`collect()`帮助函数基于一个数组被创建 或者直接通过`MuCTS\Collections\Collection`类实例化。

- 一个非常简单的使用`collect()`帮助函数的示例：

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

- 求和 `sum()`

```
