Problem Statement
How would you reverse the order of words in a string using PHP?
Explanation
You can split the string into an array of words, reverse the array, and join it back into a string. This rearranges word order rather than individual letters.
Code Solution
SolutionRead Only
$words = explode(' ', $str); echo implode(' ', array_reverse($words));Practice Sets
This question appears in the following practice sets:
