I want to group this array. please help me..
Array
(
[0] => [email protected]
[1] => [email protected]
[2] => [email protected]
)
And my expected output is
Array
(
[0] => [email protected]
)
I want to group this array. please help me..
Array
(
[0] => [email protected]
[1] => [email protected]
[2] => [email protected]
)
And my expected output is
Array
(
[0] => [email protected]
)
Look at array_unique
which will remove duplicates from the array.
<?php
// Assuming your array is stored as $arr
$arr = array(
'[email protected]',
'[email protected]',
'[email protected]'
);
// Remove the duplicates
$arr = array_unique($arr);
// Print to test
echo '<pre>'.var_export($arr, TRUE).'</pre>';
I assume you wish to remove duplicates, luckily PHP has a function called array_unique
Use it like so:
$array = array( "[email protected]", "[email protected]", "[email protected]" );
$array = array_unique( $array );