Maison >développement back-end >tutoriel php >怎么把数组键名键值重置
array(6) {
[0] => string(6) "品牌"
[1] => string(6) "ABC"
[2] => string(6) "颜色"
[3] => string(20) "黄色|红色|黄色"
[4] => string(6) "型号"
[5] => string(18) "20FGH-111"
}
结果:
array(3) {
["品牌"] => string(6) "ABC"
["颜色"] => string(20) "黄色|红色|黄色"
["型号"] => string(18) "20FGH-111"
}
完全没有头绪啊,谢谢。
for($i=0; $i<count($原数组); $i+=2) { $新数组[$原数组[$i]] = $原数组[$i+1];}