时间:2021-07-01 10:21:17 帮助过:23人阅读
$a = Array (
10 => '准备买',
11 => '不准备换',
12 => Array ( 0 => '3厢小轿车', 1 => '城市SUB' ),
13 => 33333,
14 => Array ( 0 => '中型', 1 => '小巧型' ),
15 => '全险',
);
foreach($a as $k=>$v) {
if(is_array($v)) $a[$k] = join(',', $v);
}
print_r($a);
Array
(
[10] => 准备买
[11] => 不准备换
[12] => 3厢小轿车,城市SUB
[13] => 33333
[14] => 中型,小巧型
[15] => 全险
)
$a = array (
10 => '准备买',
11 => '不准备换',
12 => Array ( 0 => '3厢小轿车', 1 => '城市SUB' ),
13 => 33333,
14 => Array ( 0 => '中型', 1 => '小巧型' ),
15 => '全险',
);
$b=array();
foreach($a as $k=>$v){
$b[$k]=$v;
if(is_array($v)){
$b[$k]=$v[0].','.$v[1];
}
}
print_r($b);
Array
(
[10] => 准备买
[11] => 不准备换
[12] => 3厢小轿车,城市SUB
[13] => 33333
[14] => 中型,小巧型
[15] => 全险
)