On Fri, Dec 26, 2008 at 12:06 PM, Mike Panchenko <m...@mihasya.com> wrote: > Hey everybody, I'm new both to the list and to hacking the internals, so > I'll try to keep it short and humble. > > I've written an array_flatten function which just takes all elements from a > nested array and pushes them into a single indexed array. > > Couple of questions: > > 1. Most importantly, is this patch-worthy to everybody? I was a bit > surprised that it didn't already exist (it wasn't difficult to write, even > for me :) ), and a search turns up quite a few posts both on the PHP doc > comments and elsewhere detailing how to do the same in usersland PHP. There > are some pretty clear usecases for this, such as doing statistics on a > grouped dataset, as well as grabbing all values from a single-column SQL > query. It's a very simple, unobtrusive patch.
regarding SQL: PDO has nice $stmt->fetchAll(PDO::FETCH_COLUMN) mode which does exactly this :) > 2. One of the PHP implementations "preserved keys." This seems > counterintuitive to me, as there's a high probability of overwriting, and I > can't think of a usecase where one would want to flatten out an array, but > keep the keys. Nonetheless, it was implemented by one of the snippets I saw. > Should the function offer this option with a $preserveKeys = false optional > param? If so, how should I handle duplicate keys? Failure? Warning? IMO, > it's not worthwhile, but I wanted to get opinions. > > 3. (this is where the noob comes in) What is the protocol on creating > patches? Should I just run the CVS patch command against a major revision? I > haven't used that before, but it seems straight forward enough. If someone > can point me to a writeup of the exact "correct" way to generate a patch, > I'd appreciate it. "cvs diff -u" against 5.3 branch shoould be ok for the start. after positive review, "cvs diff -u" against HEAD would be needed to -- Alexey Zakhlestin http://www.milkfarmsoft.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php