Suppose, I've a following string variable containing such kind of string.
$sample_String = "Dummy User graded your comment \"\r\n\t\t\t\t\tdoc_ck.docx\r\n\t\t\t\t\tDownload\r\n\t\t\t\t\t\" that you posted.";
Now I don't want these HTML characters in my string.
How should I remove them in an efficient and reliable way? I want the final output string as follows :
$sample_String = "Dummy User graded your comment \"doc_ck.docx Download\" that you posted.";
When it will be shown in a browser the '\'
appearing before " will get disappear and the string in a browser will look like below :
Dummy User graded your comment "doc_ck.docx Download" that you posted.
Isn't it?
Thanks.
Till now I've tried below code but no success :
function br2nl($buff = '') {
$buff = mb_convert_encoding($buff, 'HTML-ENTITIES', "UTF-8");
$buff = preg_replace('#<br[/\s]*>#si', "\n", $buff);
$buff = trim($buff);
return $buff;
}
$sample_String = br2nl(stripslashes(strip_tags($sample_String)));