Doc #65894 [Ver]: array_reduce needs a clarification of how the callback parameters are used
| From: | frozenfire@php.net | Date: | Tue, 31 Dec 2013 20:12:46 +0000 |
| Subject: | Doc #65894 [Ver]: array_reduce needs a clarification of how the callback parameters are used | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10783@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65894&edit=1
ID: 65894
Updated by: frozenfire@php.net
Reported by: inefedor at gmail dot com
Summary: array_reduce needs a clarification of how the
callback parameters are used
Status: Verified
Type: Documentation Problem
Package: Arrays related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The callback definitely needs improved documentation, which could easily be sourced from the notes
on the page.
Previous Comments:
------------------------------------------------------------------------
[2013-10-14 14:47:11] inefedor at gmail dot com
[typo] ...like one supposed to STORE result in this variable...
------------------------------------------------------------------------
[2013-10-14 14:45:51] inefedor at gmail dot com
Description:
------------
Hi,
In the documentation on array_reduce function ( http://php.net/manual/ru/function.array-reduce.php
) there's callback in the parameters list and it is defined like so "mixed callback (
mixed &$result , mixed $item )".
The $result parameter, for some reason, is being received by reference. But it doesn't make any
sense, does it? This variable is destroyed right after zend_call_function call was made.
I know, it might seem like pretty minor bug, but it confused me (and my colleagues) so many times.
It may seem like one supposed to result in this variable instead of returning it, so there lays a
confusion...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65894&edit=1