[PHP Tutorial] Limiting text by a number of characters, cutting off at the end of a word. (strrpos).

Spread the love

From Good-Tutorials: PHP Limiting text by a number of characters, cutting off at the end of a word. (strrpos).:

If you need to display source text, but you only want to show an excerpt of it and you will probably use the function strrpos to cut your text by a number of characters. This can look ugly as it cuts the text mid-string. Beneath is a tutorial showing you how to cut your text by a certain amount of characters and at the end of the word.


Spread the love
Proudly powered by WordPress
Creative Commons License
EricBrooks.Com® is licensed under a Creative Commons License.

Disclaimer: The views expressed herein are solely those of Eric Brooks. They do not necessarily reflect those of his employers, friends, contacts, family, or even his pets (though my cat, Puddy, seems to agree with me on many key issues.). In accordance to my terms of use, you hereby acknowledge my right to psychoanalyze you, practice accupuncture, and mock you incessantly with every visit. As the user, you also acknowledge that the author has been legally declared a "Problem Adult" by the Commonwealth of Pennsylvania, and is therefore not responsible for any of his actions. ALSO, the political views and products advertised on this site may/may not reflect the views of Puddy or myself, so please don't take them as an endorsement. We just need to eat.


Connect