php 数组合并
0 =>
array (size=1)
'txt' => string '中雨' (length=6)
1 =>
array (size=1)
'txt' => string '中雨' (length=6)
2 =>
array (size=1)
'txt' => string '雷阵雨' (length=9)
3 =>
array (size=1)
'txt' => string '雷阵雨' (length=9)
4 =>
array (size=1)
'txt' => string '雷阵雨' (length=9)
array (size=5)
0 =>
array (size=1)
'tmp_min' => string '23' (length=2)
1 =>
array (size=1)
'tmp_min' => string '22' (length=2)
2 =>
array (size=1)
'tmp_min' => string '23' (length=2)
3 =>
array (size=1)
'tmp_min' => string '23' (length=2)
4 =>
array (size=1)
'tmp_min' => string '23' (length=2)
array (size=5)
0 =>
array (size=1)
'date' => string '27日' (length=5)
1 =>
array (size=1)
'date' => string '28日' (length=5)
2 =>
array (size=1)
'date' => string '29日' (length=5)
3 =>
array (size=1)
'date' => string '30日' (length=5)
4 =>
array (size=1)
'date' => string '31日' (length=5)
合并成这种格式只能用foreach 吗,有没有php自带的函数可以执行;
array (size=5)
0 =>
array (size=1)
'tmp_min' => string '23' (length=2)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
1 =>
array (size=1)
'date' => string '28日' (length=5)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
2 =>
array (size=1)
'date' => string '29日' (length=5)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
3 =>
array (size=1)
'date' => string '30日' (length=5)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
4 =>
array (size=1)
'date' => string '31日' (length=5)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
回复内容:
array (size=5)
0 =>
array (size=1)
'txt' => string '中雨' (length=6)
1 =>
array (size=1)
'txt' => string '中雨' (length=6)
2 =>
array (size=1)
'txt' => string '雷阵雨' (length=9)
3 =>
array (size=1)
'txt' => string '雷阵雨' (length=9)
4 =>
array (size=1)
'txt' => string '雷阵雨' (length=9)
array (size=5)
0 =>
array (size=1)
'tmp_min' => string '23' (length=2)
1 =>
array (size=1)
'tmp_min' => string '22' (length=2)
2 =>
array (size=1)
'tmp_min' => string '23' (length=2)
3 =>
array (size=1)
'tmp_min' => string '23' (length=2)
4 =>
array (size=1)
'tmp_min' => string '23' (length=2)
array (size=5)
0 =>
array (size=1)
'date' => string '27日' (length=5)
1 =>
array (size=1)
'date' => string '28日' (length=5)
2 =>
array (size=1)
'date' => string '29日' (length=5)
3 =>
array (size=1)
'date' => string '30日' (length=5)
4 =>
array (size=1)
'date' => string '31日' (length=5)
合并成这种格式只能用foreach 吗,有没有php自带的函数可以执行;
array (size=5)
0 =>
array (size=1)
'tmp_min' => string '23' (length=2)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
1 =>
array (size=1)
'date' => string '28日' (length=5)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
2 =>
array (size=1)
'date' => string '29日' (length=5)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
3 =>
array (size=1)
'date' => string '30日' (length=5)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
4 =>
array (size=1)
'date' => string '31日' (length=5)
'date' => string '27日' (length=5)
'txt' => string '中雨' (length=6)
不考虑三维数组么?
参考:array_combine(array_column($arr, 'age'), array_column($arr, 'name'));
php版本至少需要5.5才可以用array_column
上一篇: ROS学习--第1篇:ROS安装
下一篇: 广联达笔试题汇总