我想在多维数组中创建数据表。我已经完成了第一步。现在我有一些误解,我把数组分成相似的日期,现在我想再用相似的键值来划分。我举了个例子以便更好地理解。
我有什么:
Array
(
[2016-05-01 00:00:00] => Array
(
[0] => Array
(
[type_pay] => 0
[oper_type] => 4
[name_pay] => CLICK
[name_oper] => Основной долг
[time_pay] => 2016-05-01 00:00:00
[amount] => 1461128
)
[1] => Array
(
[type_pay] => 1
[oper_type] => 3
[name_pay] => Наличные
[name_oper] => Депозит
[time_pay] => 2016-05-01 00:00:00
[amount] => 207866
)
[2] => Array
(
[type_pay] => 1
[oper_type] => 4
[name_pay] => Наличные
[name_oper] => Основной долг
[time_pay] => 2016-05-01 00:00:00
[amount] => 707246
)
[3] => Array
(
[type_pay] => 2
[oper_type] => 3
[name_pay] => Терминал
[name_oper] => Депозит
[time_pay] => 2016-05-01 00:00:00
[amount] => 95756
)
[4] => Array
(
[type_pay] => 2
[oper_type] => 4
[name_pay] => Терминал
[name_oper] => Основной долг
[time_pay] => 2016-05-01 00:00:00
[amount] => 329478
)
)
)
我的php循环,我分为日期
foreach ($data["reports"][1] as $value) {
$bydate[$value['time_pay']][] = $value;
}
我想得到什么
Array
(
[2016-05-01 00:00:00] => Array
(
[Основной долг] => Array
(
[0] => Array
(
[type_pay] => 0
[oper_type] => 4
[name_pay] => CLICK
[name_oper] => Основной долг
[time_pay] => 2016-05-01 00:00:00
[amount] => 1461128
)
[1] => Array
(
[type_pay] => 1
[oper_type] => 4
[name_pay] => Наличные
[name_oper] => Основной долг
[time_pay] => 2016-05-01 00:00:00
[amount] => 707246
)
[2] => Array
(
[type_pay] => 2
[oper_type] => 4
[name_pay] => Терминал
[name_oper] => Основной долг
[time_pay] => 2016-05-01 00:00:00
[amount] => 329478
)
)
[Депозит] => Array
(
[0] => Array
(
[type_pay] => 1
[oper_type] => 3
[name_pay] => Наличные
[name_oper] => Депозит
[time_pay] => 2016-05-01 00:00:00
[amount] => 207866
)
[1] => Array
(
[type_pay] => 2
[oper_type] => 3
[name_pay] => Терминал
[name_oper] => Депозит
[time_pay] => 2016-05-01 00:00:00
[amount] => 95756
)
[2] => Array
(
[type_pay] => 2
[oper_type] => 4
[name_pay] => Терминал
[name_oper] => Депозит
[time_pay] => 2016-05-01 00:00:00
[amount] => 329478
)
)
)
)