How does php regular expression match or str_replace replace the English degree symbol?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.