Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个数组
$array1 = array(33=>'abc,bcd,cde,def'); $array2 = array(33=>'fgh,ghi,hij,ijk');
如何添加两个数组以获得以下结果?
$array3 = array(33=>'abc,bcd,cde,def,fgh,ghi,hij,ijk');
提前致谢...
我想您想为多个键自动执行此操作。尝试这样的事情:
$newArray = array(); foreach ($array1 as $key => $value) { $newArray[$key] = $array1[$key] . ',' . $array2[$key]; }
请记住,如果数据不完全匹配,您将需要检查数据是否在两个数组中。