|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-03-21 04:52 UTC] deng5765 at gmail dot com
Description: ------------ Different behaviour of str_word_count function in different operating system(CentOS and MacOS) for Chinese text. It return 0 for pure Chinese text under CentOS. I tested PHP 7.1 and PHP 7.2, same issue. Seems can't find any clue in doc. Test script: --------------- <?php $content = '我不是鱼测试'; echo 'PHP OS: ', PHP_OS, "\n"; echo 'PHP Version: ', PHP_VERSION, "\n"; echo 'Word Count: ', str_word_count($content), "\n"; Expected result: ---------------- PHP OS: Darwin PHP Version: 7.3.3 Word Count: 6 PHP OS: Linux PHP Version: 7.3.3 Word Count: 6 Actual result: -------------- PHP OS: Darwin PHP Version: 7.3.3 Word Count: 6 PHP OS: Linux PHP Version: 7.3.3 Word Count: 0 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Please try on both architectures: var_dump(ctype_alpha('我不是鱼测试'));