<?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;?>
输出结果如下: word by string a Reversing 希望本文所述对大家的php程序设计有所帮助。