Re[2]: [PHP] erge on a text file
| From: | Richard Kurth | Date: | Sun, 10 Sep 2000 21:14:57 +0000 |
| Subject: | Re[2]: [PHP] erge on a text file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16079@lists.php.net to get a copy of this message | ||
Hello Adam,
Sunday, September 10, 2000, 2:37:36 PM, you wrote:
AC> Could you tell us what format the the file is in? Is each number on a new
AC> line?
Yes each number is on a new line like this
1494211
2368963
6902920
4335433
0700043
9235075
6720910
9038221
7984004
9234361
AC> I am trying to get this script to look at a text file with a list of
AC> numbers a see if the number is there. Every time I run this script it
AC> tells me that it is not there even when I know that it is. Is there a
AC> better way of doing this.
AC> <?php
AC> $webfile = "data1.txt";
AC> $number ="1494211";
AC> if(strlen($number) != 7) {
AC> echo "Sorry, but $number is not a valid number\n";
AC> exit;
AC> }
AC> if (ereg( $number , $webfile)){
AC> exit;
AC> }
AC> else {
AC> echo "This not a valed number $number";
AC> }
?>>
AC> Richard
--
Best regards,
Richard mailto:rkurth@pacifier.com