ID: 23964
Updated by: [EMAIL PROTECTED]
Reported By: prof_moriarty at veryfast dot biz
Status: Wont fix
Bug Type: Feature/Change Request
Operating System: Win98 se
PHP Version: 4.3.2
New Comment:
I also think we shouldn't add the multilevel functionality here, as
it's pretty easy to do in userspace (yes, array_sum() should have been
something for userspace too). All other functions you mentioned *can*
be done in userspace, but would be much slower.
Previous Comments:
------------------------------------------------------------------------
[2003-06-04 09:54:56] prof_moriarty at veryfast dot biz
Yes, but that's not the point.
array_sum can be done in user_space.
as can:
array_fill,
array_pad,
array_pop
array_push
array_rand
array_count_values
Indeed, most of the array_ function can be done with a couple of lines
of code.
i.e. array_push:
>From the manual!!!!:
"Has the same effect as:
$array[] = $var;"
That's just ONE line of code, and an apricot could get in it's sleep.
:)
Noting that it was only the third attempt that got it even relatively
correct, it goes to show that it's not so simple... (i've been playing
with PHP for 2+ years, and the other wrong one was a @php.net type!!!)
So could someone _please_ unset this as 'won't fix' (seeing as i
can't), and reset to 'open?
Thanx
------------------------------------------------------------------------
[2003-06-03 22:22:03] [EMAIL PROTECTED]
can be done in user-space.. :)
------------------------------------------------------------------------
[2003-06-03 12:37:56] prof_moriarty at veryfast dot biz
fair point & good catch.
Mind, now you've gone and re-inforced my point about us 'mere
mortals'.
;)
I'm assuming 'php-general is the general mailing list.
------------------------------------------------------------------------
[2003-06-03 06:36:08] [EMAIL PROTECTED]
This should be on php-general by now, but...
Why the inner foreach? According to the stated problem, you *know*
which key you're looking for, so why not go straight for it? So...
function proposed_function($array, $key)
{
$total = 0;
foreach($array as $subarr)
if (isset($subarr[$key]))
$total += $subarr[$key];
return $total;
}
------------------------------------------------------------------------
[2003-06-02 19:52:53] prof_moriarty at veryfast dot biz
You see, if someone with a php.net e-mail addy get's it wrong, what
hope do us 'mere-mortals' have?!?!?! hehe
;)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/23964
--
Edit this bug report at http://bugs.php.net/?id=23964&edit=1