• View our reviews on Hot Scripts
  • JS Tutorial

Recent Comments

Powered by Disqus

Back to articles

Split unicode string into array of letters

This function allows you to split strings with unicode characters into array with single letters as elements.

header('Content-Type:text/html; charset=UTF-8');
function uni_strsplit($string, $split_length=1)
    preg_match_all('`.`u', $string, $arr);
    $arr = array_chunk($arr[0], $split_length);
    $arr = array_map('implode', $arr);
    return $arr;
$unicode = uni_strsplit("Āēūžčš");
echo "<pre>";
echo "</pre>";

You may also be interested in:

Powered by

blog comments powered by Disqus