This should work:
$words = explode(' ', $string);
$words = array_map('strrev', $words);
echo implode(' ', $words);
Or as a one-liner:
echo implode(' ', array_map('strrev', explode(' ', $string)));
More Related Contents:
- How to reverse a Unicode string
- Reverse the order of space-separated words in a string
- How can I get a hex dump of a string in PHP?
- Remove new lines from string and replace with one empty space
- PHP, get file name without file extension
- URL Friendly Username in PHP?
- PHP: Split string [duplicate]
- Mixing a PHP variable with a string literal
- PHP equivalent of .NET/Java’s toString()
- How to mimic Stack Overflow Auto-Link Behavior
- how to replace special characters with the ones they’re based on in PHP?
- How can I truncate a string to the first 20 words in PHP?
- Remove control characters from PHP string
- Convert flat array to a delimited string to be saved in the database
- Split string by new line characters
- string sanitizer for filename
- How to split a long string without breaking words?
- PHP String to Float
- How do you pull first 100 characters of a string in PHP
- How to convert a string to JSON object in PHP
- Get the first letter of each word in a string
- PHP variable interpolation vs concatenation [duplicate]
- Separate space-delimited words in a string [duplicate]
- Close open HTML tags in a string
- Return the portion of a string before the first occurrence of a character in PHP [duplicate]
- Delete first 3 characters and last 3 characters from String PHP
- How can I get the last 7 characters of a PHP string?
- Convert a String to Variable
- How to convert all characters to their html entity equivalent using PHP
- Limit String Length