My variable $content contains my text. I want to create an excerpt from $content and display the first sentence and if the sentence is shorter than 15 characters, I would like to display the second sentence.

I've already tried stripping first 50 characters from the file, and it works:

<?php echo substr($content, 0, 50); ?>

But I'm not happy with results (I don't want any words to be cut).

Is there a PHP function getting the whole words/sentences, not only substr?

Thanks a lot!

Edit
Report