From: prof_moriarty at veryfast dot biz
Operating system: Win98 se
PHP version: 4.3.2
PHP Bug Type: Feature/Change Request
Bug description: Multi-dimensional array sum
This is tricky to explain, but easy to understand.
At present there's a function: array_sum that adds up all the values in an
array.
I would like to suggest somthing similar, and at the same time
intrinsically different.
The ability to sum up an elements value in a multi-dimensional array.
Example multi-dim-array:
array (
'box1' =>
array (
'height' => 5,
'length' => 10,
'width' => 3.5,
),
'box2' =>
array (
'height' => 17,
'length' => 9,
'width' => 8,
),
)
The above array contains two boxes and a few dimensions...
What do i do if i want to work out the combined height of the boxes (to
see if they can fit into a space)? I could write a little function to do
it sure.
But i figure quite a few other people could use this little function too,
so i'll suggest it to you.
some clarification, using the above example array.
the syntax for the function could be:
mixed proposed_function(array input, string element_name)
An example of it in use:
$result = proposed_function($array_to_manipulate, 'height');
echo $result;
The result would be:
22 //becase 5 + 17 = 22 :)
I hope thats clear...
Keep up the good work folks... :)
--
Edit bug report at http://bugs.php.net/?id=23964&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23964&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23964&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23964&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23964&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23964&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23964&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23964&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23964&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23964&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23964&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23964&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23964&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23964&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23964&r=gnused