if found duplicate text remove from while loop in php code example Example: php remove duplicates from string $str = implode(',',array_unique(explode(',', $str)));