following code for int
type in my case. just change function appropriately when you want to change
public function flattenUnique(array $array) {
$return = array();
array_walk_recursive($array, function($a) use (&$return) { $return[] = intval($a); });
return array_unique( $return );
}