How does php regular expression match or str_replace replace the English degree symbol? I want to convert the special English level symbol into "". I haven't made a good decision on how to write it. Does anyone know? Thank you for your help!
Reply to discussion (solution)
Why can't anyone answer this question?
Let's look at the code. let's see where there is a problem.
"Zgy 90 °" is to remove the degree symbol of this string.
Code 1
$ Str = "zgy 90 °"; echo str_replace ('°', ', $ str );
:
$ Str = "dfdfsdsf ° zgy ° 90 °"; echo str_replace ('°', ', $ str )."
"; Echo preg_replace ('/(°) +/','', $ str );
It's strange that the str_replace I used just now is not correct. solve it according to what you gave.
Thank you!
Character set problems!
If you create a new document and change the suffix to php, will this file still be gb2312 encoded by default? it always needs to be converted to UTF-8 encoding, and only special characters will be displayed.