Thank you for that info. It got me started on this.
I've been working on my own code for a bit here, but for some reason, one of my for loops isn't being accessed.
What I'm doing:
I take $title and explode that into an array. In the for loop which is outputing the actual data, I am also exploding an array part into another array.
For instance:
$searchTitleArray = explode(" ", $title); // not in this for loop, but above
...
$actualTitleArray = explode(" ", $array[0]);
$searchTitleSize = sizeof(searchTitleArray);
$actualTitleSize = sizeof($actualTitleArray);
$wordVal = 0; //resets the variable for the next loop
for ($l = 0; $l < $actualArraySize; $l++)
{
if ($actualTitleArray[$l] == $searchTitleArray[$l])
{
$wordVal = $wordVal + 1;
}
else
{
$wordVal = $wordVal;
}
}
$wordSimilar = $wordVal / $actualArraySize;
echo $wordSimilar ."%<br>". $actualArraySize ."<br>". $searchArraySize ."<br>". $wordVal;
So, it goes through, and doesn't appear to be hitting my second loop. $wordVal will either be 0 or empty (if I comment it out). So none of my calculations work. The values themselves are set ($actualTitleSize = 4, $searchTitleSize = 1)
Full source: http://www.superwad.ca/tv-listing/search.phps
Live Demo: http://www.superwad.ca/tv-listing/search.php
Thanks to anybody who can help me!