From: [EMAIL PROTECTED]
Operating system: openbsd/linux
PHP version: 4.0.6
PHP Bug Type: Feature/Change Request
Bug description: array_sum changed
I would like array_sum() to be able to handel multi-dimentional arrays.
this doesnt work.
<?php
$test[][] = 1;
$test[][] = 2;
$test[][] = 3;
echo array_sum($test);
?>
ive wrote a simple function to make this work.
<?php
function array_sum_multi($value, $reset = '1')
{
static $sum;
if ($reset)
$sum = 0;
if (is_array($value))
foreach($value as $pos => $val)
array_sum_multi($val, 0);
else
$sum += $value;
return $sum;
}
$test[][] = 1;
$test[][] = 2;
$test[][] = 3;
echo array_sum_multi($test);
?>
just would be nice to see included.
Chris Lee
[EMAIL PROTECTED]
--
Edit bug report at: http://bugs.php.net/?id=12028&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]