xety / arrayor
一个简单的类,提供了一些操作数组的函数。
v1.0.0
2016-11-06 23:07 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- cakephp/cakephp-codesniffer: dev-master
- phpunit/phpunit: 3.*
This package is auto-updated.
Last update: 2024-09-05 00:10:29 UTC
README
一个简单的类,提供了一些操作数组的函数。
要求
- 📦 Composer
函数
Arrayor::camelizeIndex($array, $delimiter = '_')
- 将第一级中的所有索引键转换为驼峰式。
$array = [ 'Index key' => 1, 'key_index' => 2 ]; $result = Arrayor::camelizeIndex($array); $result = [ 'indexKey' => 1, 'keyIndex' => 2 ];
Arrayor::implodeRecursive($array = [], $glue = ' : ', $separator = ' | ')
- 通过键和值将数组转换为字符串。
$array = [ 'key-index' => 1, 'key index' => 'value' ]; $string = Arrayor::implodeRecursive($array); $string = 'key-index : 1 | key index : value';