I have been working on this for 2 days now. I have a form with a text box that allows 180 characters, if a user types in something with no spaces it wrecks my site since there is no space for the text to wrap in the table cell when it displays. I'm trying to come up with a regular expression that checks for spaces in the string, and if there are no spaces, to add a space after 50 characters this way the text will wrap properly. All my searches have lead me to trim() but I'm not trying to remove space. anyone have any ideas?

8 Years
Discussion Span
Last Post by mission_PHP

A great thing about PHP is that because it's so chock-full of crap functions sometimes you find one that's useful :P


Sweet, here I was going the long way around it. I had no idea PHP had that function built in. This worked like a champ for me. There is so much to learn about PHP.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.