You don't only need to call that function you need to use the returned value as well. Do
$tmp=array_unique($tmp);
Just calling that function and not picking up the returned value does no good.
There are some functions that operate on the original variable and hence you dont need to pick up their ret val for example sort()sort() but array_uniquearray_unique() is not one of them. Always refer to http://www.php.net/functionName to find out