Error Php shorten text function, need correction -
i'm not sure i'm missing.
i've try looking @ syntax , miss spelling function name
but seems can't find problems
the problem come line 4 coding
<?php 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; } }
you closed twice function , have put =. instead of .= use ide, underline errors...
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; }
Comments
Post a Comment