php数组去重

  1. for($i=0;$i<count($expectArea);$i++) {  
  2.           $source=$expectArea[$i];  
  3.           if(array_search($source,$expectArea)==$i && $source<>"" ) {  
  4.             $result[]=$source;  
  5.       }  
  6. }  
  7. print_r($result)  
  8.   
  9.   
  10. 去重函数:  
  11. array_unique()   //去掉数组中的重复的值,并返回结果数组(一维数组)  




本文最后更新于 2015-03-30 19:26:33 并被添加「php php函数」标签,已有 2893 位童鞋阅读过。
本文作者:未来往事
本站使用「署名 4.0 国际」创作共享协议,可自由转载、引用,但需署名作者且注明文章出处

相关文章

此处评论已关闭