ID: 12028
Updated by: [EMAIL PROTECTED]
Reported By: lee at mediawaveonline dot com
-Status: Open
+Status: Wont fix
Bug Type: Feature/Change Request
Operating System: openbsd/linux
PHP Version: 4.0.6
New Comment:
This can be done in user space just fine. No need to add more specific
function into PHP for this.
regards,
Derick
Previous Comments:
------------------------------------------------------------------------
[2001-07-10 18:51:07] lee at mediawaveonline dot com
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 this bug report at http://bugs.php.net/?id=12028&edit=1