Is there a quick, simple way to check if a file is ASCII or binary with PHP?
this way it seems ok in my project:
function probably_binary($stringa) {
$is_binary=false;
$stringa=str_ireplace("\t","",$stringa);
$stringa=str_ireplace("\n","",$stringa);
$stringa=str_ireplace("\r","",$stringa);
if(is_string($stringa) && ctype_print($stringa) === false){
$is_binary=true;
}
return $is_binary;
}
PS: sorry, my first post, I wanted to add a comment to previous one :)