#42566 [Opn->Fbk]: array_reduce coverts '' to 0 for initial value
| From: | jani@php.net | Date: | Thu, 06 Sep 2007 10:41:03 +0000 |
| Subject: | #42566 [Opn->Fbk]: array_reduce coverts '' to 0 for initial value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-117212@lists.php.net to get a copy of this message | ||
ID: 42566
Updated by: jani@php.net
Reported By: lindsay at marshall dot name
-Status: Open
+Status: Feedback
-Bug Type: Unknown/Other Function
+Bug Type: Arrays related
Operating System: Fedora
PHP Version: 5.2.4
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Previous Comments:
------------------------------------------------------------------------
[2007-09-05 14:59:16] lindsay at marshall dot name
Description:
------------
If you want to use array_reduce to produce a string rather than a
number you cannot set the initial string to be '' as it is converted to
0. You can work round this but it is not elegant. There seems to be no
reason why array_reduce should not work with strings (it did in 4.x)
Reproduce code:
---------------
see comment on array_reduce page
Expected result:
----------------
see comment on array_reduce page
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42566&edit=1