|
Posted by Erwin Moller on 09/02/05 17:55
Ivo wrote:
> Hello newsgroup,
> A Note that I just posted in the PHP manual at the page describing
> the array_combine() function:
> <URL: http://www.php.net/array-combine#56424 >
> contains this code:
>
> function array_combine_emulated( $keys, $vals ) {
> $keys = array_values( (array) $keys );
> $vals = array_values( (array) $vals );
> $n = max( count( $keys ), count( $vals ) );
> $r = array();
> for( $i=0; $i<$n; $i++ ) {
> $r[ $keys[ $i ] ] = $vals[ $i ];
> }
> return $r;
> }
>
> I did take great care as it was my first ever contribution to the User
> Contributed Notes, but still a nasty mistake slipped in: instead of the
> use of the function max() in the example code given, there should of
> course have been either a call to min(), or some padding mechanism for the
> shorter array. It 's too embarrassing to add another note about, so for
> the record I figured this newsgroup might be more appropriate.
> Must be the thrill of contributing,
> ivo
> http://4umi.com/web/
Don't worry man. :-)
You ARE contributing, so you are OK.
The good news: Sometimes, when some php.net-maintainer has time for it, they
scan through the contributions and clear them up a bit. Happened to some of
my 'great remarks' on php.net. ;-)
So: Just repost your improved code, with a remark that the original was
wrong, and eventually your original posting will be deleted.
Best wishes and good weekend.
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|