Hi, 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
The html output is
I want to remove the – the dash
I want to do this:
$new_string = str_replace ('-','',$string);
I've tried to parse the string with html_entity_decode, to parse the character to remove with htmlspecialchars,but without any results.
What I'm doing wrong?
-EDIT- This is the full code of my script:
$title = 'Super Mario Galaxy 2 - Debut Trailer'; // Fetched from the DB, in the DB the character is - (minus) not –
$new_title = str_replace(' - ', '', $title);
$new_title = str_replace(" - ", '', $title);
$new_title = str_replace(html_entity_decode('–'),'',$title);
No one works. Basically the problem is that in the DB the dashes are stored as "minus" (I enter the value with the minus key) but for a strange reason the output is &ndash ;
I'm running on Wordpress and the charset is UTF-8, the same for the DB collation.