I have a line like this:
'' Spain, France, Spain, Germany, France, Spain
you need only unique substrings
"Spain, France, Germany
the only way I could think of is to convert to an array and vice versa:
$countries = "spain,france,spain,germany,france,spain";
$country = implode( ",", array_unique( explode( ",", $countries ) ) );
Another / correct way to do this?
source
share