Monday, October 26, 2015

PHP Remove special (non printable) characters from text

 

$mystring = " Fund BDM’s were then able to engage with 19 employers, most of whom were subsequently converted to the MTAA Super Clearinghouse.
";
preg_replace("/[^\x0A\x20-\x7E]/",'', $mystring);

echo $mystring;

//The above code will result in

Fund BDMs were then able to engage with 19 employers, most of whom were subsequently converted to the MTAA Super Clearinghouse..
        

No comments:

Post a Comment