Jump to content

str_replace Not Matching Some Characters


Rykin

Recommended Posts

I am using str_replace() to clean up some data I am getting from another source and it is working just fine in some instances but not at all in others. For instance it isn't replacing … or ‘ or ’ or a number of other characters.

 

I am feeding str_replace two arrays, one with the characters/strings to replace and another with the characters/strings to replace them with. Any ideas why it would be replacing some characters just fine but not others?

Link to comment
Share on other sites

Tried using that mb_str_replace function from that thread but it just returned a bunch of warnings and didn't work. Sounds like this is an issue with str_replace though so I guess I will just write a function that uses preg_replace for all the strings/characters that str_replace has issues with.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.