Created
November 9, 2012 20:35
-
-
Save drewwells/4048077 to your computer and use it in GitHub Desktop.
find unique characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode 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