php合并数组的函数array_merge应用实例

发布时间:2019-08-09编辑:脚本学堂
php合并数组的函数array_merge应用实例,供大家学习参考。

php合并数组的函数array_merge应用实例,供大家学习参考。
 

复制代码 代码如下:

<?php
//var_dump($_POST['description']);
if($type=="1"){
$arr1 = array(
"mcou"    => $_POST['mcou'],
"scou"    => $_POST['scou']
);
}else if($type=="2"){
$arr1 = array(
"yjcou"   => $_POST['yjcou'],
"dzcou"   => $_POST['dzcou']
);
}else if($type=="3"){
$arr1 = array(
"dycou"   => $_POST['dycou']
);
}

$arr2 = array(
"name"    => getstr($_POST['name'], 30, 1, 1, 1) ,
"classid"  => intval($_POST['classid']),
"typeid"  => intval($_POST['type']),
"storeid" => intval($_POST['storeid']),
"integral"=> intval($_POST['integral']),
"effect"  => $_POST['effect'],
"recommend" =>intval($_POST['recommend']),
"introduct" => getstr($_POST['introduct'], 0, 1, 1, 1) ,
"valid"   =>  getstr($_POST['valid'], 10, 1, 1, 1) ,
"displayorder" => intval($_POST['displayorder']),
"lastupdate" => $_JOYEGB['timestamp']
);

$arr = array_merge($arr1,$arr2);
?>