yurybykov/array_order_by
Composer 安装命令:
composer require yurybykov/array_order_by
包简介
A PHP function to database-style order an array.
README 文档
README
A PHP function to database-style order an array. I am not author of original function, it was taken from http://php.net/manual/ru/function.array-multisort.php
Install
Normal install via Composer.
Usage
Throw any array or object with the coordinates of the field you want to sort by:
$data = []; $data[] = array('volume' => 67, 'edition' => 2); $data[] = array('volume' => 86, 'edition' => 1); $data[] = array('volume' => 85, 'edition' => 6); $data[] = array('volume' => 98, 'edition' => 2); $data[] = array('volume' => 86, 'edition' => 6); $data[] = array('volume' => 67, 'edition' => 7); // Pass the array, followed by the column names and sort flags $sorted = array_order_by($data, 'volume', SORT_DESC, 'edition', SORT_ASC);
统计信息
- 总下载量: 857
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unlicense
- 更新时间: 2017-07-22