[TOC] > [参考](https://github.com/CismonX/ext-collections) ## 概述 c 语言扩展实现的 php 数组操作 ## demo ``` $employees = [ ['name' => 'Alice', 'sex' => 'female', 'age' => 35], ['name' => 'Bob', 'sex' => 'male', 'age' => 29], ['name' => 'David', 'sex' => 'male', 'age' => 40], ['name' => 'Benjamin', 'sex' => 'male', 'age' => 32] ]; $names = Collection::init($employees) ->filter(function ($value) { return $value['sex'] == 'male'; }) ->sortedByDescending(function ($value) { return $value['age']; }) ->map(function ($value) { return $value['name']; }) ->toArray(); // You got $names == ['David', 'Benjamin', 'Bob']. ```