Php string inversion method based on words, php string word inversion. Php string inversion method based on words. php string word inversion this article describes the php string inversion method based on words. Share it with you for your reference. The php string inversion method based on words.
This example describes how to reverse a php string by word. Share it with you for your reference. The specific analysis is as follows:
The following php code reversely outputs a string by word. In fact, the string is separated by space into an array, and then the array is reversed.
<? Php $ s = "Reversing a string by word"; // break the string up into words $ words = explode ('', $ s ); // reverse the array of words $ words = array_reverse ($ words); // rebuild the string $ s = implode ('', $ words); print $ s;?>
The output result is as follows:
Word by string a Reversing
I hope this article will help you with php programming.
Examples in this article describes how to reverse a php string by word. Share it with you for your reference. Details...