RE: [PHP] counting number of lines in file() that match a regexp

2001-09-16 Thread Don Read
On 16-Sep-2001 Kurt Lieber wrote: > I'm trying to take a text file and count the number of lines that match > a regexp. I've got it working using the following code: > > $data = file("myfile.txt"); > $total = 0; > foreach($data as $i) { > if (ereg("^1,",$i)) { > $total = $to

[PHP] counting number of lines in file() that match a regexp

2001-09-16 Thread Kurt Lieber
I'm trying to take a text file and count the number of lines that match a regexp. I've got it working using the following code: $data = file("myfile.txt"); $total = 0; foreach($data as $i) { if (ereg("^1,",$i)) { $total = $total + 1; } } but I'm still learning PH