Strip all whitespace characters except ' ' (space)
I need to remove the leading and trailing whitespace and line returns from the following variable:
$section_description = preg_replace('/\s+/','',$section_descrip tion);
This has no effect:
$section_description = preg_replace('/ \t\n\x0B\f\r+/','',$section_description) ;
Any help?
$section_description = "The following removes -all- whitespace:
asdf test one two three
";
$section_description = preg_replace('/\s+/','',$section_descrip
echo $section_description;
asdftestonetwothree
This has no effect:
$section_description = preg_replace('/ \t\n\x0B\f\r+/','',$section_description)
echo $section_description;I read that \s is synonymous with \t\n\x0B\f\r. But that doesn't appear to be the case, or I'm misunderstanding something..
asdf test one two three
Any help?
