PHP detection UTF8 word number, including Chinese

/ **
* Test the number of UTF8 words, including Chinese
* @Param $ STR
* @return int
* /
function get_utf8_words_count ($ STR)
{[ PREG_MATCH_ALL (“/ [\ x01- \ x7f] | [\ xc2- \ xdf] [\ x80- \ xbf] | [\ xe0- \ xef] [\ x80- \ xbf] {2} | [\ xf0 – \ xff] [\ x80- \ xbf] {3} / “, $ STR, $ A);
Return Count ($ ar [0]);
}

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment