我如何在php中复制一个数组[重复]

This question already has an answer here:

I want to group this array. please help me..

Array
(
    [0] => dghfdih@hjuh.cvh
    [1] => dghfdih@hjuh.cvh
    [2] => dghfdih@hjuh.cvh
)

And my expected output is

 Array
    (
        [0] => dghfdih@hjuh.cvh

    )
</div>

I assume you wish to remove duplicates, luckily PHP has a function called array_unique

Use it like so:

$array = array( "dghfdih@hjuh.cvh", "dghfdih@hjuh.cvh", "dghfdih@hjuh.cvh" );

$array = array_unique( $array );

Look at array_unique which will remove duplicates from the array.

<?php
// Assuming your array is stored as $arr
$arr = array(
    'dghfdih@hjuh.cvh',
    'dghfdih@hjuh.cvh',
    'dghfdih@hjuh.cvh'
);
// Remove the duplicates
$arr = array_unique($arr);
// Print to test
echo '<pre>'.var_export($arr, TRUE).'</pre>';