[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/phputf8/native/ -> strlen.php (source)

   1  <?php
   2  /**
   3  * @version $Id: strlen.php 10381 2008-06-01 03:35:53Z pasamio $
   4  * @package utf8
   5  * @subpackage strings
   6  */
   7  
   8  /**
   9  * Define UTF8_STRLEN as required
  10  */
  11  if ( !defined('UTF8_STRLEN') ) {
  12      define('UTF8_STRLEN',TRUE);
  13  }
  14  
  15  //--------------------------------------------------------------------
  16  /**
  17  * Unicode aware replacement for strlen(). Returns the number
  18  * of characters in the string (not the number of bytes), replacing
  19  * multibyte characters with a single byte equivalent
  20  * utf8_decode() converts characters that are not in ISO-8859-1
  21  * to '?', which, for the purpose of counting, is alright - It's
  22  * much faster than iconv_strlen
  23  * Note: this function does not count bad UTF-8 bytes in the string
  24  * - these are simply ignored
  25  * @author <chernyshevsky at hotmail dot com>
  26  * @link   http://www.php.net/manual/en/function.strlen.php
  27  * @link   http://www.php.net/manual/en/function.utf8-decode.php
  28  * @param string UTF-8 string
  29  * @return int number of UTF-8 characters in string
  30  * @package utf8
  31  * @subpackage strings
  32  */
  33  function utf8_strlen($str){
  34      return strlen(utf8_decode($str));
  35  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1