Doc #65894 [Opn->Ver]: array_reduce needs a clarification of how the callback parameters are used

From: Date: Tue, 31 Dec 2013 20:12:11 +0000
Subject: Doc #65894 [Opn->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-10782@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 documentation: callback has parameter by reference +Summary: array_reduce needs a clarification of how the callback parameters are used -Status: Open +Status: Verified Type: Documentation Problem Package: Arrays related PHP Version: Irrelevant Block user comment: N Private report: N 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

« previous php.doc.bugs (#10782) next »