im trying to remove from my string the comma separeted and multiples strings and then to count strings as total, i have no luck so.. any help will be apreciated, thanks!
Example names [alex,daniel,obama,alex,alex,alex,diana] = 7 names and without duplicates = 4 as total. This i'm trying to achive.
Here's the Php code:
$q = mysqli_query($db,"SELECT DISTINCT(names) FROM users WHERE uid = 1 ");
while ($data = mysqli_fetch_array($q)) {
$names = count($data['names']);
echo implode(',', array_keys(array_flip(explode(',',$names))));
}