Last active
October 14, 2016 08:35
-
-
Save gemmadlou/acbd64a0194a712df812ebf89e7011ce to your computer and use it in GitHub Desktop.
Typography Utility
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
| <?php | |
| class Typography { | |
| public static function removeHangingWord($title) { | |
| preg_match('/( )[&a-z]{1,2}([ ]){1}([&a-zA-Z]){3,}/', $title, $matches); | |
| if (isset($matches[0])) { | |
| $title_partial = str_replace(' ', ' ', ltrim($matches[0], ' ')); | |
| $title = str_replace($matches[0], " $title_partial", $title); | |
| } | |
| return $title; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment