I've looked at other solutions here and here, but it's not working for me.
Code
$s1clean = 'ALIEN - FILM - MOVIE – PSP – Sony - Boxed & Complete';
echo $s1clean;
echo "<br><br>";
// Remove dash
$s1clean = str_replace('-', '', $s1clean);
// Remove em dash
$em_dash = html_entity_decode('–', ENT_COMPAT, 'UTF-8');
$s1clean = str_replace($em_dash, '', $s1clean);
$em_dash2 = html_entity_decode('—', ENT_COMPAT, 'UTF-8');
$s1clean = str_replace($em_dash2, '', $s1clean);
$s1clean = str_replace('\u2014', '', $s1clean);
echo $s1clean;
echo "<br><br>";
Output
"ALIEN FILM MOVIE – PSP – Sony Boxed & Complete"
How do I remove this character?
The above didn't work for me but this did:
$s1clean = str_replace(chr(151), '', $s1clean); // emdash
Note: for endash use
$s1clean = str_replace(chr(150), '', $s1clean); // endash
from Jay: http://php.net/manual/en/function.str-replace.php#102465
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With