时间:2021-07-01 10:21:17 帮助过:14人阅读
$data1 = array(
[0] => array(
times => '2012-10-10',
type =>0,
num =>100
),
[1] => array(
times => '2012-10-11',
type =>0,
num =>103
),
....
)
$data2 = array(
[0] => array(
times => '2012-10-10',
type =>1,
num =>400
),
[1] => array(
times => '2012-10-11',
type =>1,
num =>403
),
....
)
$data = array(
[0] => array(
times => '2012-10-10',
type =>0,
num =>100
type =>1,
num =>400
),
[1] => array(
times => '2012-10-11',
type =>0,
num =>103
type =>1,
num =>403
),
....
)
$date=array(array("time"=>"2012-11-10","type0"=>0,"num0"=>100),array("time"=>"2012-11-11","type0"=>0,"num0"=>103));
$date1=array(array("time"=>"2012-11-10","type1"=>1,"num1"=>105),array("time"=>"2012-11-11","type1"=>1,"num1"=>120));
$cnt=count($date);
for($i=0;$i<$cnt;$i++){
$date2[$i]=array_merge($date[$i],$date1[$i]);
}
echo "";";
print_r($date);
print_r($date1);
print_r($date2);
echo "
//结果如下
Array
(
[0] => Array
(
[time] => 2012-11-10
[type0] => 0
[num0] => 100
)