Home > Backend Development > PHP Tutorial > 两个一维数组 如何交叉?

两个一维数组 如何交叉?

WBOY
Release: 2016-06-13 10:09:06
Original
1202 people have browsed it

两个一维数组 怎么交叉??在线等!
Array
(
  [0] => Alibaba-owned “Alipay” and “Taobao”, the payment system and E-commerce platform, 
  [1] => Statistics show that national personal online shopping sales reached to 248.
  [2] => With about 30 percent of China's 420 million strong Internet users shopping online, logistics
)
Array
(
  [0] => 易观国际分析师陈寿送分析认为,阿里集团体系中的支付宝宝网等
  [1] => 据相关数据显示,2009年,使物流企业的利润空间得到很大的提升。
  [2] => 在中国拥有1.2亿网购用户的市场环境下,物流是网上购物最大的障碍。
)

两个数组怎么写可以做交叉! 我想得到的效果如下.我

Array
(
  [0] => 易观国际分析师陈寿送分析认为,阿里集团体系中的支付宝宝网等
  [1] => Alibaba-owned “Alipay” and “Taobao”, the payment system and E-commerce platform, 
  [2] => 据相关数据显示,2009年,使物流企业的利润空间得到很大的提升。
  [4] => Statistics show that national personal online shopping sales reached to 248.
  [5] => 在中国拥有1.2亿网购用户的市场环境下,物流是网上购物最大的障碍。
  [6] => With about 30 percent of China's 420 million strong Internet users shopping online, logistics
)


------解决方案--------------------
foreach($arr1 AS $key=>$val)
{
 $new_arr[] = $val;
 $new_arr[] = $arr2[$key];
}

------解决方案--------------------
直接使用函数array_combine($array1,$array2);
array1被当做Key,array2被当做values。
直接使用,先输出一个values值再输出一个key值。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template