Skip to content

Commit 7cb4945

Browse files
committed
Merge pull request #95 from layershifter/2.x
Issue #94 UTF8Utils::countChars() - extra bad perfomance with iconv_s…
2 parents 97f171b + 9d94fa5 commit 7cb4945

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/HTML5/Parser/UTF8Utils.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ class UTF8Utils
4848
public static function countChars($string)
4949
{
5050
// Get the length for the string we need.
51-
if (function_exists('iconv_strlen')) {
52-
return iconv_strlen($string, 'utf-8');
53-
} elseif (function_exists('mb_strlen')) {
51+
if (function_exists('mb_strlen')) {
5452
return mb_strlen($string, 'utf-8');
53+
} elseif (function_exists('iconv_strlen')) {
54+
return iconv_strlen($string, 'utf-8');
5555
} elseif (function_exists('utf8_decode')) {
5656
// MPB: Will this work? Won't certain decodes lead to two chars
5757
// extrapolated out of 2-byte chars?

0 commit comments

Comments
 (0)