当前位置:编程学习 > php >>

php删除数组重复值代码

php删除数组重复值代码

<?php
$a = array(array(88,'www.226511.com'),array(88,'www.226511.com'),array(88,'www.226511.com'),array(89,'虎虎'),array(89,'呼唤'));
$new_a=array_chunk($a,3);
$arr = array();
$arr[] = array_unique($new_a[0]);
$arr[] = $new_a[1];
echo '<pre>';
print_r($arr);
?>


<?php
        $a = array(array(88,'www.226511.com'),array(88,'www.226511.com'),array(88,'www.226511.com'),array(89,'虎虎'),array(89,'呼唤'));
        $arr=array_chunk($a,3);
        foreach($arr as $key=>$value){
                $row[]=array_unique($arr[$key]);
        }
        echo"<pre>";
        print_r($row);
?>

补充:Php教程,Php入门
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,