|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-01-19 12:35 UTC] jfo123 at hotmail dot com
Description:
------------
str_word_count corrupts string with extended charset as in the swedish character set. Special chars are deleted from the string.
Reproduce code:
---------------
$title0 = "V?rlden ?r ?ngestfylld f?r katastrof";
$num_words = str_word_count($title0, 2);
foreach ($num_words AS $pos => $word) {
if ($pos < 50)
$title .= " $word";
}
print $title;
}
Expected result:
----------------
V?rlden ?r ?ngestfylld f?r katastrof
Actual result:
--------------
Vrlden r ngestfylld fr katastrof
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 16:00:02 2025 UTC |
Take away the last } nothing else. Parsable code: #-------------------- $title0 = "V?rlden ?r ?ngestfylld f?r katastrof"; $num_words = str_word_count($title0, 2); foreach ($num_words AS $pos => $word) { if ($pos < 50) $title .= " $word"; } print $title;