Log in

View Full Version : PHP string wraping



fileserverdirect
11-28-2007, 12:02 AM
Hello,
I have a script that emails me a form responce, But when the string was submitted, One long un-wraped line came up because the user never pressed enter, it just looked wraped. How (in php) can you add a new line after (lets say) 30 charaters and without disrupting a word so this doesn't happen:


Hello Joe,
I thought you we
re coming into to
wn last weeken
d? Oh well, catc
h you later! By
e!

Thanks in advanced,

jc_gmk
11-28-2007, 08:54 AM
use the wordwrap() function

e.g.

$text = "users input";

$message = wordwrap($text, 30);