Difference between mb_substr and substr

Poonam Bhatt picture Poonam Bhatt · Oct 29, 2012 · Viewed 19.5k times · Source

Will it make any difference or impact on my result, if I use substr() instead of mb_substr() function?

As my server does not have support for mb_ functions, I have to replace it with substr()

Answer

Saad Achemlal picture Saad Achemlal · May 21, 2019

If you have utf-8 encoding use mb_substr

Example :

echo substr("hi mémé", 0 , 5); // will print hi m�
echo mb_substr("hi mémé", 0 , 5); // will print hi mé