note 61656 deleted from function.array-reduce by levim

From: Date: Mon, 24 Feb 2014 16:23:22 +0000
Subject: note 61656 deleted from function.array-reduce by levim
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198628@lists.php.net to get a copy of this message
Note Submitter: marcel dot oehler at kubusmedia dot com ---- 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...

« previous php.notes (#198628) next »