I needed a way to trim all white space and then a few chosen strings from the end of a string. So I wrote this class to reuse when stuff needs to be trimmed. <?phpclass cleaner {function cleaner ($cuts,$pinfo) {$ucut = "0";$lcut = "0";while ($cuts[$ucut]) {$lcut++;$ucut++;}$lcut = $lcut - 1;$ucut = "0";$rcut = "0";$wiy = "start";while ($wiy) {if ($so) {$ucut = "0";$rcut = "0";unset($so);}if (!$cuts[$ucut]) {$so = "restart";} else {$pinfo = rtrim($pinfo);$bpinfol = strlen($pinfo);$tcut = $cuts[$ucut];$pinfo = rtrim($pinfo,"$tcut");$pinfol = strlen($pinfo); if ($bpinfol == $pinfol) { $rcut++; if ($rcut == $lcut) { unset($wiy); } $ucut++; } else { $so = "restart"; }}}$this->cleaner = $pinfo;}}$pinfo = "Well... I'm really bored...<br /><br> \n\t <br><br /><br> \r\r <br>\r<br /><br>\r \n<br> <br />\t";$cuts = array('\n','\r','\t',' ',' ',' ','<br />','<br>','<br/>');$pinfo = new cleaner($cuts,$pinfo);$pinfo = $pinfo->cleaner;print $pinfo;?>That class will take any string that you put in the $cust array and remove it from the end of the $pinfo string. It's useful for cleaning up comments, articles, or mail that users post to your site, making it so there's no extra blank space or blank lines.