I have zipcodes being outputted, coming from user inputted values. Looks like it is outputting zero-width-space \u200b sometimes at the beginning of the strings.
What is the best way to replace these from within php before echoing the variable?
I have zipcodes being outputted, coming from user inputted values. Looks like it is outputting zero-width-space \u200b sometimes at the beginning of the strings.
What is the best way to replace these from within php before echoing the variable?
Ok, seems as though this was coming from the actual string being echo'd by PHP, so I did the following to the string:
$zipcode = trim(utf8_decode($zipcode), '?');
All seems fine now!
I use this function to trim unicode spaces - this should work in your case too.
function trimUnicode($str) {
return preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$str);
}