note 71463 added to function.array-product
| From: | bishop at osu1 dot php dot net | Date: | Thu, 30 Nov 2006 03:13:52 +0000 |
| Subject: | note 71463 added to function.array-product | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120177@lists.php.net to get a copy of this message | ||
Yet another implementation of array_product() using PHP's native array_reduce():
if (! function_exists('array_product')) {
function array_product($array) {
if (is_array($array)) {
return (0 == count($array) ? 0 : array_reduce($array, '_array_product', 1));
} else {
trigger_error('Param #1 must be an array', E_USER_ERROR);
return false;
}
}
function _array_product($v,$w) { return $v * $w; }
}
----
Server IP: 216.194.113.175
Probable Submitter: 24.148.147.65
----
Manual Page -- http://www.php.net/manual/en/function.array-product.php
Edit -- https://master.php.net/note/edit/71463
Del: integrated -- https://master.php.net/note/delete/71463/integrated
Del: useless -- https://master.php.net/note/delete/71463/useless
Del: bad code -- https://master.php.net/note/delete/71463/bad+code
Del: spam -- https://master.php.net/note/delete/71463/spam
Del: non-english -- https://master.php.net/note/delete/71463/non-english
Del: in docs -- https://master.php.net/note/delete/71463/in+docs
Del: other reasons-- https://master.php.net/note/delete/71463
Reject -- https://master.php.net/note/reject/71463
Search -- https://master.php.net/manage/user-notes.php