string rtrim ( string str [, string trim_chars] ) only trims whitespace from the righthand side of a string.
<? $string = rtrim(" testing "); ?>