简体   繁体   中英

Replace single and double reversed quotes to typewriter quotes in php

I'm trying to single reverse and double reversed quote in PHP using str_replace method but its not getting replaced. I tried to convert it using htmlentities() and replace it using their html values but its not also working.

Here's the code:

$text = htmlspecialchars($text, ENT_QUOTES, "UTF-8");
$text = str_replace("‛", "'", $text);

2nd attempt:

$text = str_replace("‛", "'", $text);

Reference for single and double reversed quote: http://en.wikipedia.org/wiki/Quotation_mark_glyphs

这应该工作:

$text = str_replace(htmlspecialchars("‛"), "'", $text);

@Eugene This should be the one. You forgot _decode .

$text = str_replace(htmlspecialchars_decode("‛"), "'", $text);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM