PHP mb_substr() not working correctly?

前端 未结 2 2032
野趣味
野趣味 2021-02-12 12:11

This code

print mb_substr(\'éxxx\', 0, 1);

prints an empty space :(

It is supposed to print the first character, é. This seems

2条回答
  •  囚心锁ツ
    2021-02-12 12:41

    Try passing the encoding parameter to mb_substr, as such:

    print mb_substr('éxxx', 0, 1, 'utf-8');
    

    The encoding is never detected automatically.

提交回复
热议问题