Question: I`m trying to do the next task:
I have a string, for ex. "Product with a very long name so that it goes on to more than one line". I want to make next customization: if a number of charackters in the string (without spaces) will be more than 22, cut it on the last word, and add "...".

Answer: 
```
if(strlen($myString)>=22)
{
  $result = substr($myString, 0, 22)."...";
}
else
{
  $result = $myString;
}

```
You can do like this:

```
<?php
$text = "A very long woooooooooooord.";
if(strlen($text) > 22 ) {
 echo substr($text, 1, 22)."..";
} else {
echo $text;
}

?>

```