PHP: Text cropping with defining the number of characters, words or sentences
// March 18th, 2009 // 2 Comments » // PHP, PHP Tips, Web Development
I have recently been working on PHP RSS reader script that was supposed to do three different things with RSS description text. To make a teaser RSS text, I was asked to develop the functionality in a such a way that text can be cropped in these three ways.
- with defining the number of words.
- with defining the numbers of characters.
- with defining the number of sentences.
Here is a set of functions that helps you crop a text in three different ways. The usage of the function is also mentioned at the end f the script. (more…)







