> -----Original Message-----
> From: Anthony Ferrara [mailto:ircmax...@gmail.com] 
> 
> > text_to_array($s) == str_split($s, 1)
> 
> No, because str_split always splits into 1 byte chunks.  text_to_array
> would take the character set into account (or that's where the utility
> in it would be)...

I think this does what you want:

function utf8_str_split($s)
{
        return preg_split("/(.)/u", $s, null, PREG_SPLIT_DELIM_CAPTURE | 
PREG_SPLIT_NO_EMPTY);
}

John Crenshaw
Priacta, Inc.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to