Possible Duplicate:
PHP merge array(s) and delete double values
I need to merge two arrays. I know I can use the array_merge
function.
But it displays all the elements in both the arrays. But I need to replace all the similar values with a single value instead of all the values.
For example
$array1 = array("2", "3", "4");
$array2 = array("2", "7", "8");
If I use the array_merge
function above the output will be 2,3,4,2,7,8
but I want it to be 2,3,4,7,8
. I mean the value two should not repeat again. I hope there is a function to do my task. Please point it out to me