I know that there are many types of space (em space, en space, thin space, non-breaking space, etc), but, all these, that I refered, have HTML entities (at least, PHP\'s htm
$result = preg_replace('/\s/', '', $yourString)
See http://www.php.net/manual/en/regexp.reference.backslash.php for more infos on the \s
\s