note 61656 added to function.array-reduce

From: Date: Wed, 08 Feb 2006 15:26:31 +0000
Subject: note 61656 added to function.array-reduce
Groups: php.notes 
Request: Send a blank email to php-notes+get-103316@lists.php.net to get a copy of this message
I've just experienced some really strange behaviour of array_reduce in PHP 5.0.4: $result = array( 0, 17, 0, 0, 33, 0, 0, 0, 0, 50); $total = array_reduce( $result, "sumCalc", 0); function sumCalc( $a, $b){ return $a + $b; } and $total equals to 83! I know, this could be done easier, but it should work nevertheless. Has anybody experienced something similar? I will avoid using array_reduce in the future... ---- Server IP: 194.153.94.11 Probable Submitter: 212.254.141.131 ---- Manual Page -- http://www.php.net/manual/en/function.array-reduce.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61656 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61656&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61656&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61656&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61656&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61656&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61656&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61656&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61656&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103316) next »