Changeset 9499


Ignore:
Timestamp:
Mar 3, 2011, 10:10:09 PM (9 years ago)
Author:
LucMorizur
Message:

LCAS_mbStringToArray does not require any more that extension mbstring is loaded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/include/functions.inc.php

    r9400 r9499  
    66
    77/**
    8  * Splits a multi-byte string in a array of each of its characters.
    9  * Many thanks to adjwilli in
    10  * http://www.php.net/manual/fr/function.mb-split.php#80046
     8 * Split a multi-byte string in a array of each of its characters.
     9 * Many thanks to Whiler ;-) in
     10 * http://fr.piwigo.org/forum/viewtopic.php?pid=162907#p162907
    1111 *
    1212 * @param string s: string to split
     
    1515*/
    1616function LCAS_mbStringToArray($s) {
    17   $l = mb_strlen($s); $a = array();
    18   while ($l) {
    19     $a[] = mb_substr($s, 0, 1, 'UTF-8');
    20     $s = mb_substr($s, 1, $l, 'UTF-8');
    21     $l = mb_strlen($s);
    22   }
    23   return $a;
     17  return preg_split('//u', $s, -1, PREG_SPLIT_NO_EMPTY);
    2418}
    2519
Note: See TracChangeset for help on using the changeset viewer.