user6582353 user6582353 - 6 months ago 70
PHP Question

Error Php shorten text function, need correction

I'm not sure where I'm missing.

I've try looking at the syntax and also the miss spelling function name

but it seems I can't find that problems

the problem is come from line 4 coding


function shortenText($text, $maxlength=70, $appendix = "..."){
$text = strip_tags($text);
if(mb_strlen($text) <= $maxlength){return $text;}
$text = mb_substr($text, 0, $maxlength - mb_strlen($appendix));
$text =. $appendix;
return $text;



fourth line must be : $text.= $appendix;

edit: just saw comment.I guess it was before I could complete my post.