0

I have a string link this :

"Special Word ±"

I want to replace the char ± with +-. I use str_replace('±','+-',"Special Word ±") but the result still shows:

"Special Word ±"

2
  • 1
    Works fine: 3v4l.org/PA1Wq You probably don't have the same characters. Commented Nov 5, 2016 at 0:33
  • What is the encoding of your php file and what is the encoding of your string? (are they exists in the same file or does the string come from some other source - other file/db/web request?) Commented Nov 5, 2016 at 0:38

1 Answer 1

1

This might be a problem with PHP script file encoding. Try to convert your script encoding to for example "UTF8"

Sign up to request clarification or add additional context in comments.

1 Comment

Thx..works str_replace('±','+-',utf8_encode("Special Word ±"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.