3 * @version $Id: str_split.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
8 //---------------------------------------------------------------
10 * UTF-8 aware alternative to str_split
11 * Convert a string to an array
12 * Note: requires utf8_strlen to be loaded
13 * @param string UTF-8 encoded
14 * @param int number to characters to split string by
15 * @return string characters in string reverses
16 * @see http://www.php.net/str_split
21 function utf8_str_split($str, $split_len = 1) {
23 if ( !preg_match('/^[0-9]+$/',$split_len) || $split_len < 1 ) {
27 $len = utf8_strlen($str);
28 if ( $len <= $split_len ) {
32 preg_match_all('/.{'.$split_len.'}|[^\x00]{1,'.$split_len.'}$/us', $str, $ar);