/libraries/phputf8/mbstring/strlen.php

https://github.com/collymore/test_project · PHP · 28 lines · 7 code · 2 blank · 19 comment · 1 complexity · 4add1d0bdd7bb15108c7df220cfedce5 MD5 · raw file

  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. * Define UTF8_STRLEN as required
  9. */
  10. if ( !defined('UTF8_STRLEN') ) {
  11. define('UTF8_STRLEN',TRUE);
  12. }
  13. //--------------------------------------------------------------------
  14. /**
  15. * Wrapper round mb_strlen
  16. * Assumes you have mb_internal_encoding to UTF-8 already
  17. * Note: this function does not count bad bytes in the string - these
  18. * are simply ignored
  19. * @param string UTF-8 string
  20. * @return int number of UTF-8 characters in string
  21. * @package utf8
  22. * @subpackage strings
  23. */
  24. function utf8_strlen($str){
  25. return mb_strlen($str);
  26. }