$handle = fopen("mytext.txt", "r");
echo fread($handle,filesize("mytext.txt"));
echo preg_match("/[0-9]/","",$handle);
fclose($handle);
I want to open a text file and find how many digits are there in the text. I tried to use preg_match
but I think this is not correct way to do it.
preg_match() accepts Handle for resources. Which is incorrect:
$handle = fopen("mytext.txt", "r");
$content = fread($handle,filesize("mytext.txt"));
$noDigit = preg_match("/[0-9]/","",$content);
fclose($handle);