永不停更,如果觉得好请留下一个star!
Github:https://github.com/VikinDev/v-collect
介绍:
vcollect
是一个PHP C Extension,提供流畅、便利的数组数据操作。
安装:
1、Clone
定位于PHP下的ext目录,执行
git clone https://github.com/VikinDev/v-collect.git
2、编译安装
在扩展目录内,执行
phpize
./configure
make && make install
3、修改ini
在php.ini文件中加入extension = vcollect.so
使用
创建集合
$test = vcollect([1, 2, 3, 4, 5, 6]);
可用方法
^_^ | ^_^ | ^_^ | ^_^ | ^_^ | ^_^ | ^_^ | ^_^ | ^_^ | ^_^ |
---|---|---|---|---|---|---|---|---|---|
map | collapse | avg | has | mx | mi | toJson | toArray | take | pluck |
where | ......更多方法将后续更新 |
举例:where
快速过滤或筛选集合
$vcollect = vcollect([
['developer' => ['name' => 'Taylor', 'option' => ['test' => 'one'] ] ],
['developer' => ['name' => 'Abigail', 'option' => ['test' => 'two'] ] ]
]);
$vcollect->where('developer.option.test', 'one')->toArray();
// ['developer' => ['name' => 'Taylor', 'option' => ['test' => 'one'] ] ]
永不停更,如果觉得好请留下一个star!
Github:https://github.com/VikinDev/v-collect
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。