我有一个子字符串函数的问题。当一个特殊的char是结果子字符串的最后一个字符(只有!!!)时,这个字符被表示为一个带有问号的图标。PHP:特殊字符变成问号图标子字符串
这里说到我的代码:
$string = 'This is a string and when a German word with a special char like "Tür" appears and the special char ü is the last character of the substring it gets represented as an icon with question mark';
echo substr($string,0,102). "...";
结果:
这是一个字符串,当一个德语单词包含“TUR” 出现和特殊字符特殊字符..
我该如何避免这种情况?
使用'mb_substr' – Rein