我正在尝试从数组中获取所需的输出。我从这样的 for 循环中获取数据数组:
Array
(
[TIMESLOTID] => 27
[DATE] => za 05-04-2014 15:00
[ProductID] => 196
[VariantID] => 1079
)
Array
(
[TIMESLOTID] => 27
[DATE] => za 12-04-2014 15:00
[ProductID] => 196
[VariantID] => 1079
)
Array
(
[TIMESLOTID] => 27
[DATE] => za 29-03-2014 15:00
[ProductID] => 196
[VariantID] => 1079
)
Array
(
[TIMESLOTID] => 23
[DATE] => ma 07-04-2014 10:00
[ProductID] => 196
[VariantID] => 1083
)
现在,如果 [TIMESLOTID] 、 [ProductID] 和 [VariantID] 的值匹配,则应将它们合并到一个数组中,否则在单独的数组中。输出将如下所示:
Array
(
[TIMESLOTID] => 27
[DATE] =>
Array
(
[DATE] => za 05-04-2014 15:00,
[DATE] => za 12-04-2014 15:00,
[DATE] => za 29-03-2014 15:00
),
[ProductID] => 196,
[VariantID] => 1079
),
Array
(
[TIMESLOTID] => 23,
[DATE] => ma 07-04-2014 10:00,
[ProductID] => 196,
[VariantID] => 1083
)
请帮助我。提前致谢。