- json_decode: documentation ( source)
- mb_ereg_replace: documentation ( source)
<?php
echo json_decode('"\u201E"');
// create a pair of curly quotes using \u which json_decode can handle ...
$lefty = json_decode('"\u201C"');
$righty = json_decode('"\u201D"');
$text = $lefty . "Testing" . $righty;
echo $text,"\n";
// ... but POCRE can't handle \u so use hex codes
$text = mb_ereg_replace('[\xE2\x80]+(\x9C|\x9D)+','"',$text);
echo "\n",$text;