1. CSS
  2. Flash
  3. HTML
  4. Illustrator
  5. Java
  6. JavaScript
  7. Maya
  8. Photography
  9. Photoshop
  10. PHP
  11. Ruby
  12. Ruby on Rails
  13. 3ds Max

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

  1. Clicks today:
    0
  2. Clicks this month:
    0
  3. Overall rating:
    3.67/5

PHP » Basics — over 10 years ago
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.

Comments

Your Comment

You must be logged in to post a comment.