Searching for text in a file

From: Date: Mon, 10 Sep 2001 07:11:41 +0000
Subject: Searching for text in a file
Groups: php.general 
Request: Send a blank email to php-general+get-66682@lists.php.net to get a copy of this message
I am having a problem with searching through a file for a curtain text. Like the text below jon@tester.com does not exists in the file but when I run this it gives me a Match at line number. I need to run three or four names at a time through this script to see if they are already there. But it does not seam to work. And I can not figure out way. A small sample of the file is below. $fd = fopen ("virtusertable", "r"); $line_text= "jon@tester.com"; $count = 1; while ($line_text = fgets($fd, 2048)) { if ($variable = trim($line_text)) { echo "Match at line number $count"; break; } ++$count; } gary@www.domain.com yourns@www.yourns.com root@www.nellsouth.com owner-majordomo@www.dellwebservices.com sys@www.hispeedmail.com sys@www.register.com majordomo-owner@www.register.com vellsouth2@www.vellsouth.net majordomo-owner@www.vellsouth.com root@www.vellsouth.com majordomo@www.dellwebservices.com sys@www.cyberheadlinenews.com vellsouth@www.vellsouth.com nobody@www.register.com Best regards, Richard mailto:rkurth@pacifier.com

« previous php.general (#66682) next »