I am trying to make a script that counts the number of times a specific word appears on a page.
for that I have developed the following coding.
I am using it to count words on a wordpress site.
There are 11 of those words but it only shows 9.
Tried it some other pages the same error persists.
I am using preg_match to compare strings
[php]<?php
$file=fopen(“http://www.routemybrain.com/about/","r”) or exit(“Unable”);
$i=0;
while(!feof($file))
{
$fk=fgets($file);
if(preg_match('/Akash/',$fk))
{echo $fk . "<br>";
$i++;
}
}
echo $i;
?>[/php]
please help