Created
November 28, 2011 04:25
-
-
Save msng/1399098 to your computer and use it in GitHub Desktop.
This file contains 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 | |
function mb_strimlen($str, $start, $length, $trimmarker = '', $encoding = false) { | |
$encoding = $encoding ? $encoding : mb_internal_encoding(); | |
$str = mb_substr($str, $start, mb_strlen($str), $encoding); | |
if (mb_strlen($str, $encoding) > $length) { | |
$markerlen = mb_strlen($trimmarker, $encoding); | |
$str = mb_substr($str, 0, $length - $markerlen, $encoding) . $trimmarker; | |
} | |
return $str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment