I have a very trivial problem with str_replace.
I have a line with the symbol En Dash (-) as follows:
I want to remove - the dash
Html output
I want to remove the – the dash
I want to do this:
$new_string = str_replace ('-','',$string);
I tried to parse a string with html_entity_decode in order to parse a character that needs to be removed using htmlspecialchars, but without any results.
What am I doing wrong?
-EDIT- This is the full code of my script:
$title = 'Super Mario Galaxy 2 - Debut Trailer';
$new_title = str_replace(' - ', '', $title);
$new_title = str_replace(" - ", '', $title);
$new_title = str_replace(html_entity_decode('–'),'',$title);
No one is working. Basically the problem is that the dash is stored as a minus in the database (I entered the value using the minus key), but for some strange reason, the output is -
I work on Wordpress, and the encoding is UTF-8, the same for sorting a database.