I use
PHP Code:
$MobileNumber=preg_replace('/[\s]{2,}/',' ',$MobileNumber);
the following also works and is more precise:
PHP Code:
$MobileNumber=preg_replace('/[\040]{2,}/',' ',$MobileNumber);
or if you want to replace some octal code with octal code try this:
PHP Code:
$sp="\040";
$MobileNumber=preg_replace('/[\040]{2,}/','$sp',$MobileNumber);
They all do the same thing though.
...mostly.
one more that I found on php.net
PHP Code:
$MobileNumber = preg_replace( '/\s\s+/', ' ', $MobileNumber);
There are probably more, but I can't think of any more.
Bookmarks