What i want to do is set a group of filenames into an array which as far as i know that part works fine because the filenames will print. The second part of the script takes a counter for an array, runs through each filename in the array and returns "Found It!" if the search string is found within the current file. However, this will not work and i have no idea why. Here's the code below, I'd really appreciate any help! Thanks in advance!
<?php
$handle=opendir('inc.');
$counter=1;
while (false!==($file = readdir($handle))) {
if (!is_dir($file)) {
$filename[$counter] = $file;
$counter++;
}
}
for ($yes=1; $yes<=$counter; $yes++) {
$fd = fopen ($filename[$yes], "rb");
$current_file = fread ($fd, filesize($filename[$yes]));
if(strstr($current_file,$tofind)) {
echo "Found It!";
}
fclose ($fd);
}
?>