Home > php教程 > php手册 > php二维数组去除特定键的重复项

php二维数组去除特定键的重复项

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 08:49:49
Original
831 people have browsed it

php二维数组去除特定键的重复项 无 //二维数组去除特定键的重复项 public function array_unset($arr,$key){ //$arr-传入数组 $key-判断的key值 //建立一个目标数组 $res = array(); foreach ($arr as $value) { //查看有没有重复项 if(isset($res[$value[$ke

php二维数组去除特定键的重复项
//二维数组去除特定键的重复项
    public function array_unset($arr,$key){   //$arr->传入数组   $key->判断的key值
        //建立一个目标数组
        $res = array();      
        foreach ($arr as $value) {         
           //查看有没有重复项
           if(isset($res[$value[$key]])){
                 //有:销毁
                 unset($value[$key]);
           }
           else{
                $res[$value[$key]] = $value;
           }
        }
        return $res;
    }
Copy after login
Related labels:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template