Revision: 1686
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1686&view=rev
Author:   jberanek
Date:     2010-12-09 23:01:21 +0000 (Thu, 09 Dec 2010)

Log Message:
-----------
- Made utf8_strlen() much more efficient.

Modified Paths:
--------------
    mrbs/branches/ics_attachments/web/language.inc

Modified: mrbs/branches/ics_attachments/web/language.inc
===================================================================
--- mrbs/branches/ics_attachments/web/language.inc      2010-12-09 22:58:31 UTC 
(rev 1685)
+++ mrbs/branches/ics_attachments/web/language.inc      2010-12-09 23:01:21 UTC 
(rev 1686)
@@ -828,14 +828,9 @@
 // string
 function utf8_strlen($str)
 {
-  $nchars = 0;
+  preg_match_all("/./su", $str, $ar);
 
-  while ($str != "")
-  {
-    $str = utf8_next($str);
-    $nchars++;
-  }
-  return $nchars;
+  return count($ar[0]);
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to