Re: array_unique and some questions on Zend hash internals
| From: | Stig Venaas | Date: | Sun, 04 Jun 2000 19:36:25 +0000 |
| Subject: | Re: array_unique and some questions on Zend hash internals | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-20199@lists.php.net to get a copy of this message | ||
On Sun, Jun 04, 2000 at 10:07:10PM +0300, Stanislav Malyshev wrote:
> You tell me. I just spent 3 hours looking for a way to get a row from a
> table which has maximal value of a column. Yeah, SQL books say "you cannot
> do this with max() because result is undefined and not useful". The hell I
> care! I just need to get the most recent post on forum. So it be one of
> the posts that were made in the same second, if any. Who cares? But no, I
> need to use full-table sort or launch subqueries for that...
I've had the exact same problem, and if you have a database without
subqueries...
Unless it gets too complicated and slow I will try to preserve keys and
compact indices (similar to array_splice, array_merge...).
I'm making a new version that uses the API most of the time. It's slower
but cleaner. There are a few things that are not clear, but I'll come
back to that when I have a new working version.
I think that array_pop, array_shift, array_pad and some of the other
functions could be faster. They use _phpi_splice which copies a lot
of data around. Perhaps I'll look into this later on.
Stig
--
Stig Venaas
UNINETT