I would make it an array and use the sort function:
$string = 'bac';
$stringParts = str_split($string);
sort($stringParts);
echo implode($stringParts); // abc
Related Contents:
- Delete first 3 characters and last 3 characters from String PHP
- How to Sort a Multi-dimensional Array by Value
- How to generate a random, unique, alphanumeric string?
- Remove empty array elements
- startsWith() and endsWith() functions in PHP
- PHP – concatenate or directly insert variables in string
- How can I get a hex dump of a string in PHP?
- Sorting an associative array in PHP [duplicate]
- How can I put strings in an array, split by new line?
- Truncate a multibyte String to n chars
- Remove multiple whitespaces
- How can strip whitespaces in PHP’s variable?
- Convert a comma-delimited string into array of integers?
- php/mysql with multiple queries
- php String Concatenation, Performance
- PHP equivalent of .NET/Java’s toString()
- Remove portion of a string after a certain character
- How can I replace a variable in a string with the value in PHP?
- Preserve key order (stable sort) when sorting with PHP’s uasort
- String with array structure to Array [duplicate]
- When to use strtr vs str_replace?
- How can I check if a word is contained in another string using PHP?
- Get first 100 characters from string, respecting full words
- Add … if string is too long PHP [duplicate]
- remove duplicate from string in PHP
- Sort array of objects by one property
- Include constant in string without concatenating
- Can you add an if statement in ORDER BY?
- PHP – split String in Key/Value pairs
- Fastest way of deleting a value in a comma separated list
- Sort a flat, associative array by numeric values, then by non-numeric keys
- Remove a string from the beginning of a string
- Iterate over each line in a string in PHP
- PHP quotes inside quotes
- PHP: How can I explode a string by commas, but not wheres the commas are within quotes?
- Group rows in an associative array of associative arrays by column value and preserve the original first level keys
- Sort array using array_multisort() with dynamic number of arguments/parameters/rules/data
- Get characters after last / in url
- How can I remove part of a string in PHP? [closed]
- Using usort in php with a class private function
- PHP variable interpolation vs concatenation [duplicate]
- PHP: Split multibyte string (word) into separate characters
- How does PHP compare strings with comparison operators?
- Isolate comma-separated values, remove duplicates and empty values, then sort
- How to implode array with key and value without foreach in PHP
- Most efficient way to get next letter in the alphabet using PHP
- Get last whole number in a string
- Sort multidimensional array by date column, then use other column values if dates are the same
- Why a function checking if a string is empty always returns true? [closed]
- How do I get the byte values of a string in PHP?