vcollect PHP Extension 让你优雅的处理集合!

发布时间:2019-08-07 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了vcollect PHP Extension 让你优雅的处理集合!脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

永不停更,如果觉得好请留下一个star!
GIThubhttps://github.com/VikinDev/v-collect

介绍:

vcollect 是一个PHP C Extension,提供流畅、便利的数组数据操作。


vcollect

安装:

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

脚本宝典总结

以上是脚本宝典为你收集整理的vcollect PHP Extension 让你优雅的处理集合!全部内容,希望文章能够帮你解决vcollect PHP Extension 让你优雅的处理集合!所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。