Weird dash character in PHP

前端 未结 4 1921
忘了有多久
忘了有多久 2020-12-19 07:23

I have a weird dash in my text, which isn\'t being detected in a str_replace.

Here is an example:

Sun: 10:00 – 3:00pm

I don

4条回答
  •  感情败类
    2020-12-19 07:52

    For an alternative, if other answers don't work for you, like in my case, this works for me.

    $title = "Hunting, Tactical & Outdoor Optics eCommerce Store ΓÇô $595,000 ΓÇö SOLD";
    $title = str_replace(html_entity_decode('–', ENT_COMPAT, 'UTF-8'), '-', $title);
    $title = str_replace(html_entity_decode('—', ENT_COMPAT, 'UTF-8'), '-', $title);
    

提交回复
热议问题