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?

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

php.net/wordwrap

commented: Thanks you have helped rep added +0

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

php.net/wordwrap

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.