Last active
September 10, 2015 07:19
-
-
Save stdrc/fb9a64ab20e752d02a3b to your computer and use it in GitHub Desktop.
PHP 获取字符串长度(而非字节数)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = 'Hello,世界!'; | |
preg_match_all('/./us', $str, $match); | |
echo count($match[0]); // 输出9 | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment