Re: [PHP4BETA] cvs: /php4 ChangeLog /php4/ext/standard basic_functions.c basic_functions.h

From: Date: Wed, 06 Oct 1999 16:49:47 +0000
Subject: Re: [PHP4BETA] cvs: /php4 ChangeLog /php4/ext/standard basic_functions.c basic_functions.h
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-5243@lists.php.net to get a copy of this message
Thies C. Arntzen wrote: > On Wed, 6 Oct 1999, Andrei Zmievski wrote: > > > Instead of copying zend_hash_sort, let's just rewrite shuffle() to use > > another algorithm.. > > just go ahead (lets also "backport" to PHP3 to make shuffle() work on > solaris) - Well, I guess the problem isn't in algorithm, but in how to rearrange the contents of the hash. zend_hash_sort() does a lot of things, so there are 3 ways to solve this: 1. Don't use zend_hash_sort() in shuffle(). Instead use regular hash access functions to shuffle hash. This may be slower and also problematic if the array has mixed string and numeric keys. 2. Copy zend_hash_sort() into another function, put the suggested code into it and use it. But then either zend_hash_rehash() will need to be made non-static, or we'll have to copy the code for that as well. 3. Find the source code for non-degenerative qsort() and include it with PHP so that everything uses it. I like #3. -Andrei * I don't mind going nowhere as long as it's an interesting path. *

« previous php.version4 (#5243) next »