Thread
:
PHP Whitespace Replacement
View Single Post
12-10-2012, 01:30 PM
PM User
|
#
3
Junsee
New Coder
Join Date: Jun 2012
Posts: 42
Thanks: 4
Thanked 5 Times in 5 Posts
try escaping it and also you might try \s
PHP Code:
preg_replace
(
"#[\ ]{2,}#"
,
" "
,
$string
)
preg_replace
(
"#[\s]{2,}#"
,
" "
,
$string
)
however \s will match all whitespace like a space and a tab will become " "
Junsee
View Public Profile
Find More Posts by Junsee