Jump to content

How to select first 15 words of a paragraph?


guttyguppy

Recommended Posts

Let's say I want a brief portion of a paragraph of text to show up on my homepage. The paragraph is in a mysql database and may have anywhere from 100 to 1000 words, whatever. I just want the first 15 or so. I know I can use substr to get a certain number of characters, but I may end up with the last word getting cut off. I want to make sure the 15th word is a whole word. Is there an easy way to do this? Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.