I am writing a code for display only ASCII value.I am reading a file that contain string I want when any NON-ASCII value in file discard whole string and when Ascii value display all content from file.please help me.thank you my code is
$myFile="mydata.txt";
$fh = fopen($myFile, 'r');
$completeString = fread($fh, filesize($myFile));
fclose($fh);
preg_match('/[^\x20-\x7f]/', $completeString);
if(preg_match('/[^\x20-\x7f]/', $completeString) == "1") {
$completeString = "";
}
elseif(preg_match('/[^\x20-\x7f]/', $completeString) == "0") {
$completeString ;
}