Page 1 of 1

trim: take out white spaces

Posted: Fri Mar 17, 2006 9:47 am
by vietboy505
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I have a form for use to enter...

But sometimes people like to add many return carriage, new lines.

So I want to strip it out.. The below code doesn't work.  Why is that?

Is it because it's can't recogize as "hey \n\n\t"?

Code: Select all

explode("%_%",trim($_POST["PROBLEM"], " \t \n \r \s") );

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Mar 17, 2006 9:52 am
by ol4pr0

Code: Select all

$string = str_replace("\r", '', $string);
That will take 'em out.