Remove Duplicate Characters

Remove duplicate characters from a string while keeping only the first occurrence of each character.

Code

General
implode('', array_unique(str_split($s)));

Parameters

The string to remove duplicates from

Server

More PHP Snippets