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

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

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



 

https://www.nucmc.com/ true php二维数组转一维数组 https://www.nucmc.com/show-21-513-1.html report 2078.5 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 数组
本站欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明: 文章转载自:BETWAY官网网 https://www.nucmc.com/show-21-513-1.html
BETWAY官网网 Copyright 2012-2014 www.nucmc.com All rights reserved.(晋ICP备13001436号-1)