0
,所以我有2个职位来为数组:结合两个数组
$ POST1 Array ([0] => Tipul1 [1] => tipul2 [2] => tipul3)
$ POST2 Array ([0] => cant1 [1] => cant2 [2] => cant3)
我想实现的是在DB发送这些(查询不会是一个这种格式的问题)(格式是一个问题,我的方式串联值):
Tipul 1 - cant1 | Tipul 2 - cant2 | Tipul 3 - cant3
所以,我怎么能结合这些阵列,并添加每个值之间有?
使用
foreach ($tip as $tipq) {
foreach ($cantitate as $cantitateq) {
echo $tipq.''.$cantitateq. "<br>";
}
}
我会得到这个(这是有道理的): Tipul1cant1 Tipul1cant2 Tipul1cant3 tipul2cant1 tipul2cant2 tipul2cant3 tipul3cant1 tipul3cant2 tipul3cant3
'$ arr = array_combine($ post1,$ post2)'给出'array('Tipul1'=>'cant1',...);' – JustOnUnderMillions
只要你没有显示任何尝试,我只会给你提示:你有将'Tipul1'重新格式化为'Tipul 1',...并将所有值与'$ arr [] =“$ value1 - $ value2”;'合并并收集,一个数组,那么该数组可以是'implode('| ',$ array);'那么你有你想要的 – JustOnUnderMillions