php数组循环合并的问题!

有这样的很多的数组,Array('date'=>2011-11-30,'week'=>周三001);Array('date'=>2011-11-30,'week'=>周三... 有这样的很多的数组,

Array('date' => 2011-11-30,'week' => 周三001);
Array('date' => 2011-11-30,'week' => 周三002);
Array('date' => 2011-11-30,'week' => 周三003);
Array('date' => 2011-12-01,'week' => 周四001);
Array('date' => 2011-12-01,'week' => 周四002);
Array('date' => 2011-12-01,'week' => 周四003);
Array('date' => 2011-12-02''week' => 周五001);
Array('date' => 2011-12-02,'week' => 周五002);
Array('date' => 2011-12-02,'week' => 周五003);
Array('date' => 2011-12-03,'week' => 周六001);
Array('date' => 2011-12-03,'week' => 周六002);
..........
合并成类似这样数组
$weekDate = arr(Array('date' => 2011-11-30,'week' => 星期三),Array('date' => 2011-12-01,'week' => 星期四),Array('date' => 2011-12-02,'week' => 星期五),Array('date' => 2011-12-03,'week' => 星期六))
展开
 我来答
xing31120
2011-11-30 · TA获得超过577个赞
知道小有建树答主
回答量:260
采纳率:0%
帮助的人:238万
展开全部
$all_arr = array(
Array('date' => '2011-11-30','week' => '周三001'),
Array('date' => '2011-11-30','week' => '周三002'),
Array('date' => '2011-11-30','week' => '周三003'),
Array('date' => '2011-12-01','week' => '周四001'),
Array('date' => '2011-12-01','week' => '周四002'),
Array('date' => '2011-12-01','week' => '周四003'),
Array('date' => '2011-12-02','week' => '周五001'),
Array('date' => '2011-12-02','week' => '周五002'),
Array('date' => '2011-12-02','week' => '周五003'),
Array('date' => '2011-12-03','week' => '周六001'),
Array('date' => '2011-12-03','week' => '周六002'),
);

$weekDate[] = array('date' => $all_arr[0]['date'],'week' => substr($all_arr[$i+1]['week'], 0, -3));
for($i = 0; $i < count($all_arr) -1; $i++ )
{
if($all_arr[$i]['date'] != $all_arr[$i+1]['date'])
{
$weekDate[] = array('date' => $all_arr[$i+1]['date'],'week' => substr($all_arr[$i+1]['week'], 0, -3));
}
}
更多追问追答
追问
但是那些数组都是单个的啊,怎么样把它们放到一个大数组里面呢?
追答
楼主自己去看看  数组函数吧.
都已经写成这样了还看不懂 手册有木有啊
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式