Skip to content

Instantly share code, notes, and snippets.

@drewwells
Created November 9, 2012 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewwells/4048077 to your computer and use it in GitHub Desktop.
Save drewwells/4048077 to your computer and use it in GitHub Desktop.
find unique characters
$output = '';
foreach($input as $char){
//if it's in our output already, don't concatenate it
//triple equals to avoid 0 issue
//strpos is searching for a position of the character
if(strpos($char,$output)===false){
$output.=$char;
}
}
return $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment