$n) { preg_match('/^.{1,260}\b/s', $str, $matches); return rtrim($matches[0]) ; } else { return $str; } }