php二维数组转一维数组

导语 php取出二维数组中某个键对应的值,并组成数组,过滤掉重复的值Array([0]=>Array([0]=>http: xxx com [1]=>http: www aseoe com )[1]=>Array([0]=>http: xxx com )[2]=>Array([0]=>http: www ancto net [1]=

php取出二维数组中某个键对应的值,并组成数组,过滤掉重复的值

  1. Array 
  2. ( 
  3.     [0] => Array 
  4.         ( 
  5.             [0] => http://xxx.com/ 
  6.             [1] => http://www.aseoe.com/ 
  7.         ) 
  8.  
  9.     [1] => Array 
  10.         ( 
  11.             [0] => http://xxx.com/
  12.         ) 
  13.  
  14.     [2] => Array 
  15.         ( 
  16.             [0] => http://www.ancto.net/
  17.             [1] => http://xxx.com/3333 
  18.         [2] => http://xxx.com/3333 
  19.         ) 
  20.  
  21.     [3] => Array 
  22.         ( 
  23.             [0] => http://ccc.com/ 
  24.         ) 
  25. ) 

取出数组中的链接,并放到一个一维数组中,过滤掉重复的值
 

  1. //将$old_arr二维数组转换为一维数组 
  2. foreach($old_arr as $key => $val) { 
  3.     foreach($val as $value) { 
  4.         $new_arr[] = $value; 
  5.     } 
  6. } 
  7.  
  8. //去除重复的地址 
  9. $one_arr = array_unique($new_arr);  



 

http://www.aseoe.com/ true php二维数组转一维数组 http://www.aseoe.com/show-21-513-1.html report <?php echo strlen($content) / 2; ?> php取出二维数组中某个键对应的值,并组成数组,过滤掉重复的值Array([0]=>Array([0]=>http: xxx com [1]=>http: www aseoe com )[1]=>Array([0]=>http: xxx com )[2]=>Array([0]=>http: www ancto net [1]=
TAG:php 数组
本站欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明: 文章转载自:爱思资源网 http://www.aseoe.com/show-21-513-1.html

[前端插件推荐] Plugin

1 2 3 4
  • jQuery实现逐字逐句显示插件l-by-l.min.js
  • jQuery带方向感知的鼠标滑过图片边框特效插件
  • jQuery HotKeys监听键盘按下事件keydown插件
  • 响应式无限轮播jQuery旋转木马插件
响应式无限轮播jQuery旋转木马插件
web前端开发
爱思资源网 Copyright 2012-2014 Www.Aseoe.Com All rights reserved.(晋ICP备13001436号-1)