Created
May 12, 2011 14:02
-
-
Save christiaan/968554 to your computer and use it in GitHub Desktop.
Hyphenation 20x speed increase fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: hyphenation.php | |
| =================================================================== | |
| @@ -23,13 +23,9 @@ | |
| // Convert patterns | |
| function convert_patterns($patterns) { | |
| - $patterns = mb_split(' ', $patterns); | |
| - $new_patterns = array(); | |
| - for($i = 0; $i < count($patterns); $i++) { | |
| - $value = $patterns[$i]; | |
| - $new_patterns[preg_replace('/[0-9]/', '', $value)] = $value; | |
| - } | |
| - return $new_patterns; | |
| + $keys = mb_split(' ', preg_replace('/[0-9]/', '', $patterns)); | |
| + $values = mb_split(' ', $patterns); | |
| + return array_combine($keys, $values); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment