Re: [PATCH] array_fill: Allow an array to specify keys
| From: | Marcus Boerger | Date: | Sat, 15 Jul 2006 12:14:40 +0000 |
| Subject: | Re: [PATCH] array_fill: Allow an array to specify keys | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-24391@lists.php.net to get a copy of this message | ||
Hello Matt,
thanks for the update
best regards
marcus
Saturday, July 15, 2006, 1:25:25 PM, you wrote:
> Hi Marcus,
> ----- Original Message -----
> From: "Marcus Boerger"
>> Hello Matt,
>>
>> Thursday, July 13, 2006, 12:28:27 PM, you wrote:
>>
>> There's two ways. First as you mentioned sending them as plain text files.
>> And second editing the CVS/Entries file in that directory and adding this
>> line: "/array_fill_keys.phpt/0/dummy timestamp//".
>>
>> However that's for your next patches, i added the function to HEAD and 5.2
>> after experimenting with it and mofifying it a tiny bit. I allow empty
>> arrays as that is easier for user code. Also this is inline with the
>> ability of array_fill() to specify parameter num as zero.
>>
>> Best regards,
>> Marcus
> Thanks for the CVS info and adding the function!
> I was just updating the function (and tests) for HEAD when you added it, to
> make it consistent with the changes Andrei has been making (inc. to
> array_fill yesterday):
> http://realplain.com/php/array_fill_keys-1.1.diff
> http://realplain.com/php/array_fill_keys-1.1.phpt
> Besides using parse_parameters instead of get_parameters_ex, array_fill also
> changed the handling of "val" passed by reference -- notice
> SEPARATE_ZVAL(val) is now gone compared to 5.2. I also marked it "U"nicode
> compatible, and simplified the code for filling the array, following what
> Andrei did with array_combine yesterday.
> I agree about allowing empty arrays, but I was just making it consistent
> with array_fill(), which actually *doesn't* allow parameter "num" as 0:
> "Number of elements must be positive"
> Just to clarify what I mean, the code I updated only applies to HEAD (to
> save Andrei from fixing it ;-)). The 5.2 version is OK I guess (unless you
> *want* to "simplify" the array filling loop), other than it being
> inconsistent with array_fill as far as returning an empty array.
> Thanks again,
> Matt
> P.S. Oh, no big deal, but in the NEWS file, you put "Mathew W" instead of
> "Matt W" or "Matthew W" (2 t's ;-)). And the W is for Wilmas, but the
> initial is fine; it doesn't matter to me what's there.
Best regards,
Marcus