Re: Incorrect description of function array_map()?
| From: | Robert Woodall | Date: | Wed, 02 Mar 2022 21:55:00 +0000 |
| Subject: | Re: Incorrect description of function array_map()? | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969388085@lists.php.net to get a copy of this message | ||
I kinda thought maybe it should say that it applies the function to generate the value at that index
position.
Robert Woodall
me@rwoodall.com
816-606-2722
https://rwoodall.com
Read my free user experience book
https://mtrees.io
> On Mar 2, 2022, at 7:00 AM, Peter Hunkeler <phun@gmx.ch> wrote:
>
> Thanks.
> I'll report on github next time.
> --
> Peter
>
>> Am 02.03.2022 um 13:24 schrieb Christoph M. Becker:
>>> On 01.03.2022 at 22:07, Peter Hunkeler wrote:
>>>
>>> I wonder whether the documentation of the array_map() function is correct?
>>>
>>> The documentation describes arrays as being "ordered maps that
>>> associates values to keys". The "key" is what is called
>>> "index" in other
>>> languages. The PHP doc mostly uses the word "key", and less often the
>>> word "index".
>>>
>>> I further read in the doc of "array_map()" that "array_map() returns an
>>> array containing the results of applying the callback to the
>>> corresponding index of array (and arrays if more arrays are provided)
>>> used as arguments for the callback."
>>>
>>> But the function applies the callback to each "value" of the array, not
>>> the "keys", right? Shouldn't the doc say "... applying the callback
>>> to
>>> the corresponding values of array..."?
>> Thanks! Fixed as
>>
>> <https://github.com/php/doc-en/commit/e8c83816e0ca7a4136a5991b2227ddf00fa9adc6>.
>>
>> Please report documentation bugs at
>> <https://github.com/php/doc-en/issues> next time. :)
>>
>> --
>> Christoph M. Becker