$data1 = array(5,7,2,2,8,17); //数组一$data2 = array(8,7,5,3,13,17); //数组二foreach ($data1 as $key=>$value){ //循环echo $value+$data2[$key]; //相加并输出echo \"<br>\";}
PHP——数组中对应的值相加然后输出
未经允许不得转载:爱站程序员基地 » PHP——数组中对应的值相加然后输出
$data1 = array(5,7,2,2,8,17); //数组一$data2 = array(8,7,5,3,13,17); //数组二foreach ($data1 as $key=>$value){ //循环echo $value+$data2[$key]; //相加并输出echo \"<br>\";}