Re: Searching a test file...
| From: | Burhan Khalid | Date: | Tue, 15 Jul 2003 09:50:53 +0000 |
| Subject: | Re: Searching a test file... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155262@lists.php.net to get a copy of this message | ||
On Tuesday, July 15, 2003, 9:08:25 AM, Lloyd wrote:
[ snip ]
LB> No matter what I do, it always returns "not here" even if there is a
LB> match....very frustrating!
LB> Any ideas?
Echoing what Mike said (about the preprocessing), here is some code to
help you out :
$search = "user1";
if (!($names = file("acc.txt"))) { die("Could not open acc.txt"); }
while (list($key,$val) = each($names)) {
$bits = explode(" ",$val);
while(list(,$line) = explode($bits)) {
if ($line == $search) {
echo "here";
} else { echo "whoops ... MIA"; }
}
}
--
Regards,
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com