Re: Array problems again
| From: | Jason Wong | Date: | Fri, 17 May 2002 14:09:40 +0000 |
| Subject: | Re: Array problems again | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98093@lists.php.net to get a copy of this message | ||
On Friday 17 May 2002 21:20, Josh Edwards wrote:
> Here's a sample of a weblog. I have a loop that extracts the request ie
> "Get /A1.php
> How do I get the top ten requests and how many time these were requested
> after looping thru the whole file. Can you set up an array that is self
> populating if a string doesn't match an element in the array or is there a
> better way?
>
> 203.29.154.13 - - [08/May/2002:21:21:07 +1000] "GET /A1.php
> HTTP/1.1" 200417 "-" "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"
>
> Any help is greatly appreciated.
The manual is always the best help. It's an array problem so look in the
chapter about arrays. There you'll see a function called
array_count_values(). Whilst you're there you may want to read up on what
other array functions may be useful to you.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Man is a rational animal who always loses his temper when he is called upon
to act in accordance with the dictates of reason.
-- Oscar Wilde
*/