doudai8083 2018-04-23 10:50
浏览 65
已采纳

PHP substr波斯语字符串以问号结尾

In PHP when I want to substr the Persian string 'حروف فارسی برای امتحان', and it appends the question mark at the end of string.

This is my code:

$a = 'حروف فارسی برای امتحان'; echo substr($a,0,10);

And the problem is حروف �

Anyone has any suggestion or solution for this regards? much appreciated.

  • 写回答

2条回答 默认 最新

  • dongliyan7318 2018-04-23 10:52
    关注

    use mb_substr($a,0,10,'utf-8') instead of substr() for Persian and Arabic characters

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?