Doc #65894 [Ver->Csd]: array_reduce needs a clarification of how the callback parameters are used
| From: | cmb@php.net | Date: | Wed, 20 Sep 2017 12:27:14 +0000 |
| Subject: | Doc #65894 [Ver->Csd]: 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-14984@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: cmb@php.net
Reported by: inefedor at gmail dot com
Summary: array_reduce needs a clarification of how the
callback parameters are used
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: Arrays related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This issue has been fixed with
<http://svn.php.net/viewvc?view=revision&revision=332884>.
Previous Comments:
------------------------------------------------------------------------
[2013-12-31 20:12:46] frozenfire@php.net
The callback definitely needs improved documentation, which could easily be sourced from the notes
on the page.
------------------------------------------------------------------------
[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