I have a very trivial problem with str_replace.
I have a string with the En Dash character ( - ) like this:
I want to remove - the dash
To anyone who has tried all of the above but still having no joy then this worked for me (from a WordPress get_the_title() function)
get_the_title()
$new_string = str_replace('–', 'or', $string);
Only this solution worked for me:
$string = str_replace("\x96", "-", $string);