ratacibernetica / php-flatten-array
压平数组。
v1.1
2017-05-19 20:40 UTC
Requires (Dev)
- codeception/codeception: dev-master
This package is not auto-updated.
Last update: 2024-09-14 20:04:19 UTC
README
压平数组。
安装
composer require ratacibernetica/php-flatten-array
- 预期输入
[ 1, [ 2 ], [[3],[[4]]]];
- 预期输出
[1,2,3,4]
示例用法
$multipleArray = [ 1, [ 2 ], [[3],[[4]]]]; $flattener = new ratacibernetica\FlattenArray($multipleArray); $flattenedArray = $flattener->flattened; // equals $flattenedArray, [1,2,3,4]); $otherFlat = $flattener->flattenArray( [1, [2], [3], [[4],[5]]] ); // equals( $otherFlat, [1,2,3,4,5]);
运行测试
测试位于 tests
文件夹中,可以使用 codeception 运行,如下所示
$ codecept run unit