I've made this before, but I've forgotten all of the steps. I've figured how to grab the page using the file_get_contents() function and stripped out all of the unnecessary
$data = file_get_contents("index.php"); //read the file
$data = strip_tags($data);
$data = strtoupper($data);
Next, I'm using a custom explode function which removes all of the specified separates
$sep = " ():.,!@#$%^&*[]{}?<>;";
$convert = superExplode($data, $sep);
function superExplode($str, $sep) {
$i = 0;
$arr[$i++] = strtok($str, $sep);
while($token = strtok($sep))
$arr[$i++] = $token;
return $arr;
}
And finally, I count each instance of each word using array_count_values() which stores each word as a key and word count as the value
$count = array_count_values($convert);
Now I can simply use a foreach loop to get the key and the word count to store in the database. However, the problem I'm having is that, I'm getting blank keys in the $count array when I do a print_r($count). So for example:
print_r($count);
returns:
Array ([] => 1
[] => 2
[] => 1
[HOME] => 1
[] => 1
[SUBMIT] => 1
[NEW] => 1
[VIEW] => 1)
How can I filter out the keys that have nothing in them? Thanks.