View Single Post
Old 03-04-2005, 05:30   #7 (permalink)
mattih5
Registered User
 
mattih5's Avatar
 
Join Date: Mar 2005
Location: Manchester
Posts: 62
$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.
  Reply With Quote