ID: 42566 Comment by: tjerk dot meesters at muvee dot com Reported By: lindsay at marshall dot name Status: No Feedback Bug Type: Arrays related Operating System: Fedora PHP Version: 5.2.4 New Comment:
This reproduces the bug: <?php echo array_reduce(array(' ','world'),create_function('$total,$new','return $total.$new;'),'hello'); ?> Expected: hello world Actual: 0 world Tested with PHP 5.2.0 Previous Comments: ------------------------------------------------------------------------ [2007-09-14 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-09-06 10:41:03] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [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