note 82389 deleted from function.pow by derick
| From: | derick@php.net | Date: | Thu, 29 May 2008 12:05:57 +0000 |
| Subject: | note 82389 deleted from function.pow by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-139977@lists.php.net to get a copy of this message | ||
Note Submitter: josh at thenullbyte dot org
----
Simple function to calculate a sigma:
<?php
/**
* @param int $m lower bound
* @param int $n upper bound
* @param int $i power
*/
function summate($m = 1, $n, $i)
{
while($m <= $n)
{
$sum += pow($m, $i);
++$m;
}
return $sum;
}
echo summate(2, 6, 2);
?>