|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-04-08 21:33 UTC] jani@php.net
-Package: Feature/Change Request
+Package: Arrays related
[2012-08-05 22:33 UTC] lonnyk at gmail dot com
[2012-08-06 01:06 UTC] googleguy@php.net
[2012-08-06 01:06 UTC] googleguy@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: googleguy
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Feb 14 06:00:01 2026 UTC |
Description: ------------ array_reduce() accepts an initial value to be passed as the first argument in the callback function instead of NULL. However, this initial value - if passed - is converted to an int. This is probably because the more common use of this idiom is for mathematical reduction. It would be helpful to allow other types to be passed such as strings or objects. Note: this ticket is a duplicate for #42566, but the reporter never bothered to follow up. Reproduce code: --------------- <?php echo array_reduce( array(' ','world'), create_function( '$total,$new', 'return $total.$new;' ), 'hello' ); ?> Expected result: ---------------- hello world Actual result: -------------- 0 world