二维数组

php二维数组指定字段排序

十年热恋 提交于 2021-02-05 06:05:21
工作中遇到个问题,数据来自于excel,读取出来是二维数组,需要按照指定字段排序,类似于sql的order by功能,折腾了一会儿,代码如下: class demo { public function test() { $arr = array( array( 'power' => 380, 'day' => 1, 'where' => 1, ), array( 'power' => 380, 'day' => 2, 'where' => 1, ), array( 'power' => 400, 'day' => 1, 'where' => 1, ), array( 'power' => 380, 'day' => 3, 'where' => 1, ), array( 'power' => 400, 'day' => 2, 'where' => 1, ), array( 'power' => 380, 'day' => 8, 'where' => 1, ), array( 'power' => 380, 'day' => 8, 'where' => 2, ), array( 'power' => 500, 'day' => 1, 'where' => 1, ), array( 'power' => 380, 'day' => 11, 'where' => 1, ), array(

使用awk的二维数组解决一个日志统计的实际问题

独自空忆成欢 提交于 2020-03-01 13:40:34
项目中遇到的一个实际问题,日志如下 2013-09-13 00:06:09:adid:10000254 2013-09-13 00:06:14:adid:10000254 2013-09-13 00:06:43:adid:10000253 2013-09-13 00:06:48:adid:10000254 2013-09-13 00:07:07:adid:10000254 2013-09-13 00:07:12:adid:10000254 2013-09-13 00:07:19:adid:10000254 2013-09-13 00:07:32:adid:10000254 2013-09-13 00:08:05:adid:10000254 2013-09-13 00:08:20:adid:10000240 2013-09-13 00:08:28:adid:10000253 2013-09-13 00:08:32:adid:10000253 2013-09-13 00:08:41:adid:10000254 2013-09-13 00:09:02:adid:10000253 2013-09-13 00:09:10:adid:10000254 2013-09-13 00:09:11:adid:10000240 2013-09-13 00:09:18:adid:10000254 2013