萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> php編程 >> php刪除數組重復值代碼

php刪除數組重復值代碼

php刪除數組重復值代碼

<?php
$a = array(array(88,'www.111cn.net'),array(88,'www.111cn.net'),array(88,'www.111cn.net'),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.111cn.net'),array(88,'www.111cn.net'),array(88,'www.111cn.net'),array(89,'虎虎'),array(89,'呼喚'));
        $arr=array_chunk($a,3);
        foreach($arr as $key=>$value){
                $row[]=array_unique($arr[$key]);
        }
        echo"<pre>";
        print_r($row);
?>

copyright © 萬盛學電腦網 all rights reserved