drupal_strlen

5 unicode.inc drupal_strlen($text)
6 unicode.inc drupal_strlen($text)
7 unicode.inc drupal_strlen($text)
8 unicode.inc drupal_strlen($text)

Count the amount of characters in a UTF-8 string. This is less than or equal to the byte count.

Related topics

20 calls to drupal_strlen()

File

includes/unicode.inc, line 438

Code

function drupal_strlen($text) {
  global $multibyte;
  if ($multibyte == UNICODE_MULTIBYTE) {
    return mb_strlen($text);
  }
  else {
    // Do not count UTF-8 continuation bytes.
    return strlen(preg_replace("/[\x80-\xBF]/", '', $text));
  }
}
Login or register to post comments