jizuscreed / callbackable-array-functions
一些PHP数组函数的包装器,为它们提供了回调功能
1.0.1
2018-11-11 21:11 UTC
Requires
- php: >=7.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-12 10:04:40 UTC
README
一些PHP数组函数的包装器,为它们提供了回调功能
优势
这并不是核心同名函数的另一种实现。Packet内部使用php核心同名函数(所有魔法来自装饰器),因此您可以确信,回调函数将完全像您PHP版本的核心函数一样工作
实现的函数
- array_unique
安装
使用composer
composer require jizuscreed/callbackable-array-functions
使用
<?php
use jizuscreed\CallbackableArrayFunctions\ArrayUnique;
// array of objects or another multidimensional arrays
$array = [...];
$array = ArrayUnique::run($array, function($arrayValue){
// some logic, that returns string representation of one array value. Be carefull with it because array elements will be checked for differences by result of this callback
return $arrayValue->title;
});
许可证
MIT,因此您可以自由地使用此代码