public function trimRight($chars = null) { $chars = $chars ? preg_quote($chars) : '[:space:]'; return $this->regexReplace("[{$chars}]+\$", ''); }