Re: Incorrect description of function array_map()?
Robert Woodall <[email protected]>
| Newsgroups | gmane.comp.php.documentation.general |
|---|---|
| Message-ID | <[email protected]> |
I kinda thought maybe it should say that it applies the function to generate the value at that index position. Robert Woodall [email protected] 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 <[email protected]> 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