I have to count the number of "a's" in the string:
$a = "aaa apple";
this is my code:
<?php
$file = fopen("count.txt","w");
$txt = "as a teacher i am addicted to apple";
fwrite($file,$txt);
fclose($file);
$file1 = fopen("count.txt","r");
$arr = substr_count("$file1","a");
echo $arr;
?>
however this returns 0.
which php function should i use?