I have a set of strings containing characters in a PHP script, I need to sort those characters in each string.
For example:
\"bac\" -> \"abc\" \"a
You can split the string into an array and then use any of the various sorting functions.
$in = "this is a test"; $chars = str_split($in); sort($chars); $out = implode($chars);