Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Checks for the length of a string, mb strings accounted for
- *
- * @param string The string to check the length of.
- * @return int The length of the string.
- */
- function my_strlen($string)
- {
- global $lang;
- $string = preg_replace("#&\#([0-9]+);#", "-", $string);
- if(strtolower($lang->settings['charset']) == "utf-8")
- {
- // Get rid of any excess RTL and LTR override for they are the workings of the devil
- $string = str_replace(dec_to_utf8(8238), "", $string);
- $string = str_replace(dec_to_utf8(8237), "", $string);
- // Remove dodgy whitespaces
- $string = str_replace(chr(0xCA), "", $string);
- }
- $string = trim($string);
- if(function_exists("mb_strlen"))
- {
- $string_length = mb_strlen($string);
- }
- else
- {
- $string_length = strlen($string);
- }
- return $string_length;
- }
Add Comment
Please, Sign In to add comment