PHP mb_substr() problem?

Jacob

New member
I have some code which displays a title of topics on index page. If a title longer than 40 characters i want to limit it with substr function (with - ..?)
Everything works well but sometimes when i type one long word that bigger than 40 characters at the end it returns me strange symbols like this- �.
Here is the code:
$question = $display["question"];
if(mb_strlen($question, 'UTF-8') > 40) {
$question = mb_substr($question, 0, 40).'..?';
}

BTW- only hebrew text. that's why i'm using mb_..but still no luck...
 
Back
Top