Trim unicode whitespace in PHP

preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$str);

Leave a Comment