Hi, i'm still getting errors, one in particular is this one:
Quote:
|
Warning: Variable passed to each() is not an array or object in c:\inetpub\wwwroot\oop\srchfile.php on line 83
|
I've modified the script to how you said:
PHP Code:
$SearchString = "test";
print "<a href=\"".$file."\">".$file."</a><br/>";
$fileArray = array();
$fileArray = file($file);
if (file_exists($file)) {
while(list($key,$val)=each($fileArray)){ if (stristr($SearchString,$val)){
print htmlentities($ResultLine);
}
}
} else {
echo "Error";
}
All I need it to do is search a directory for a string which exists within $searchString. The $file is a variable which is used back on in the recursive function with holds any file name. Once the search string is found the script needs to report back to the user the line number (starting @ 1) and then print out the whole line the string was found on. So, the script needs to search every file in the directory of which it is placed.