$SearchString is the test string I want to find every occurence of and $file is from a previous section of code which identifies all files within a directory. This is then hyperlinked in the code below.
PHP Code:
$SearchString = "test";
print "<a href=\"".$file."\">".$file."</a><br/>";
$fileArray = array();
$srcFile = "$file";
$fileArray = @file($srcFile);
reset($fileArray);
while(list($key,$val)=each($fileArray)){
if (stristr($SearchString,$val)){
print htmlentities($ResultLine);
}
}
The errors I keep getting are the following:
Quote:
|
Warning: reset(): Passed variable is not an array or object in c:\inetpub\wwwroot\oop\srchfile.php on line 83
|
and
Quote:
|
Warning: Variable passed to each() is not an array or object in c:\inetpub\wwwroot\oop\srchfile.php on line 84
|
I do not fully understand what this while loop is doing so I cannot help you with where the variables have come from. If anyone could help, it would be much appreciated.