Remove test functions in loop whenever it's possible

This commit is contained in:
Romain Neutron
2013-11-13 14:32:02 +01:00
parent 21f0df2cfe
commit 954ba1c0b4
2 changed files with 25 additions and 6 deletions

View File

@@ -1586,8 +1586,9 @@ class unicode
$out = '';
$_map = &self::$map[$target]; // faster in loop
$length = mb_strlen($string, 'UTF-8');
for ($i = 0; $i < mb_strlen($string, 'UTF-8'); $i++) {
for ($i = 0; $i < $length; $i++) {
if (true === array_key_exists(($c = mb_substr($string, $i, 1, 'UTF-8')), $_map)) {
$out .= $_map[$c];
} else {