Re: erge on a text file

From: Date: Sun, 10 Sep 2000 22:23:17 +0000
Subject: Re: erge on a text file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16084@lists.php.net to get a copy of this message
"Richard Kurth" <rkurth@pacifier.com> wrote ... > I am trying to get this script to look at a text file with a > list of numbers a see if the number is there. Every time > I run this script it tells me that it is not there even when > I know that it is. Is there a better way of doing this. > $webfile = "data1.txt"; > $number ="1494211"; > if (ereg( $number , $webfile)) { In your example you are searching the string $webfile, whereas you actually want to search the file named by $webfile. You must open the file, read it in to a string, then search that string.

« previous php.general (#16084) next »