I want to truncate/shorten my string to the sentence closest to a ceratain number of characters.
I have a working function, but my function truncate to the word clos
I simply use this method and it works as required!
This way no new functions are created and the code is clean and simple.
$article = strlen($article) > $maxlength ? substr($article, 0, $maxlength) : $article;