Php Security string filter function shares a php string filter function. the code is as follows: functionStripHTML ($ string) {$ patternarray (& quot; & lt; script [^ & gt;] *? & Gt ;.*? & Lt; script & gt; si & quot;, & quot; & lt; style [^ & gt;] *? & Gt ;.*? & Lt; style & gt; si & quot;, & quot php Security filter string function
Share a php string filter function with the following code:
Function StripHTML ($ string ){
$ Pattern = array ("'
] *?>. *? Script 'Si ","'
] *?>. *? 'Si "," '<[\/\!] *? [^ <>] *?> 'Si "," '([\ r \ n]) [\ s] +' "," '& (quot | #34);' I ", "'& (amp | #38);' I", "'& (lt | #60);' I", "'& (gt | #62 ); 'I ","' & (nbsp | #160); 'I ","' & (iexcl | #161); 'I ", "'& (cent | #162);' I", "'& (pound | #163);' I", "'& (copy | #169 ); 'I ","' & # (\ d +); 'e ");
$ Replace = array ('','', "\ 1", ''," & "," <","> ",'', chr (161 ), chr (162), chr (163), chr (169), "chr (\ 1 )");
Return preg_replace ($ pattern, $ replace, $ str );
}