Reading File into Array and Searching

From: Date: Tue, 15 Jan 2002 19:21:39 +0000
Subject: Reading File into Array and Searching
Groups: php.general 
Request: Send a blank email to php-general+get-80613@lists.php.net to get a copy of this message
Dear Users, I basically want to do the following. I have file that contains everyone that logs into our mail server a day and then I want to basically load that file into an array and then search the array to find out how many times that person logged in and then take the last login and capture that information from the file. I have tried doing something like this but it doesn't seem to work: $fcontents = file("/tmp/popper.test"); while (list ($line_num, $line) = each ($fcontents)) { $new_array[$line_num] = $line; } $key = array_search("wasatch.com",$new_array); print count($new_array)." matches found.\n"; Can anyone shed some light to help me? I'm using PHP 4.1.0 :)

« previous php.general (#80613) next »