数组合并 打散 php,php数组的合并与拆分

$array1 = array("A","B","C","D");

$array2 = array("1","2","3","4");

$array3 = array("!","@","#","$");

$arrayX = array_merge($array1, $array2, $array3);//将3个数组合并起来

print_r($arrayX);

?>

$array1 = array("AA"=>"A","BB"=>"B","CC"=>"C","DD"=>"D");

$array2 = array("AA"=>"1","BB"=>"2","CC"=>"3","DD"=>"4");

$array3 = array("AA"=>"!","BB"=>"@","CC"=>"#","DD"=>"$");

$arrayX = array_merge($array1, $array2, $array3);//合并数组

print_r($arrayX);

?>

$array1 = array("AA"=>"A","BB"=>"B","CC"=>"C","DD"=>"D");

$array2 = array("AA"=>"1","BB"=>"2","CC"=>"3","DD"=>"4");

$array3 = array("AA"=>"!","BB"=>"@","CC"=>"#","DD"=>"$");

$arrayX = array_merge_recursive($array1, $array2, $array3);//合并数组

print_r($arrayX);

?>

$array = array(1,2,3,4,5,6,7,8,9);

$arrayX = array_splice($array, 2, 6);//获取数组的第2个元素到第7个元素

print_r($array);

print_r($arrayX);

?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值