Use wordwrap()
to truncate the string without breaking words if the string is longer than 50 characters, and just add ...
at the end:
$str = $input;
if( strlen( $input) > 50) {
$str = explode( "\n", wordwrap( $input, 50));
$str = $str[0] . '...';
}
echo $str;
Otherwise, using solutions that do substr( $input, 0, 50);
will break words.