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.
use mb_substr($a,0,10,'utf-8') instead of substr() for Persian and Arabic characters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With