On Wednesday 16 January 2002 03:21, Devin Atencio wrote:
> 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 :)

What doesn't work? Why doesn't it work? Do you get any error messages? What 
output do you get?

As it stands your print statement will just print the number of lines in your 
file?

The function you want is probably array_count_values().

hth
-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
After Goliath's defeat, giants ceased to command respect.
- Freeman Dyson
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to