From 3893eff7b49f951a62ee54564d990fa3faf1b60f Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Fri, 28 Feb 2014 11:21:01 +0400 Subject: [PATCH] mb_strrpos instead of loop --- twisterpost.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/twisterpost.php b/twisterpost.php index d49a340..17dd47a 100644 --- a/twisterpost.php +++ b/twisterpost.php @@ -129,10 +129,7 @@ class TwisterPost $text .= ' #' . str_replace(' ', '_', (string)$tag); } $text = mb_substr($text, 0, $maxLen + 1); - $pos = $maxLen; - while (mb_substr($text, $pos, 1) !== ' ') { - $pos--; - } + $pos = mb_strrpos($text, ' '); $text = mb_substr($text, 0, $pos); }