Apparently there\'s no mb_trim in the mb_* family, so I\'m trying to implement one for my own.
mb_trim
I recently found this regex in a comment in php.net:
You can also trim non-ascii compatible spaces (non-breaking space for example) on UTF-8 strings with preg_replace('/^\p{Z}+|\p{Z}+$/u','',$str); \s will only match "ascii compatible" space character even with the u modifier. but \p{Z} will match all known unicode space characters
preg_replace('/^\p{Z}+|\p{Z}+$/u','',$str);
\s
u
\p{Z}