note 95571 added to function.gmp-mul
| From: | Nitrogen at osu1 dot php dot net | Date: | Sun, 10 Jan 2010 02:55:32 +0000 |
| Subject: | note 95571 added to function.gmp-mul | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164822@lists.php.net to get a copy of this message | ||
The code in the comment below is wrong.
The for(); loop should test if $i<=$x; not $i<$x..
<?php
function Factorial($Input=1) {
$Result=1;
for($i=2;$i<=$Input;$i++)
$Result=gmp_mul($Result,$i);
return($Result);
}
// Factorial(5); would return a GMP resource with '120'.
?>
----
Server IP: 87.124.86.45
Probable Submitter: 86.132.124.100 (proxied: 86.132.124.100)
----
Manual Page -- http://www.php.net/manual/en/function.gmp-mul.php
Edit -- https://master.php.net/note/edit/95571
Del: integrated -- https://master.php.net/note/delete/95571/integrated
Del: useless -- https://master.php.net/note/delete/95571/useless
Del: bad code -- https://master.php.net/note/delete/95571/bad+code
Del: spam -- https://master.php.net/note/delete/95571/spam
Del: non-english -- https://master.php.net/note/delete/95571/non-english
Del: in docs -- https://master.php.net/note/delete/95571/in+docs
Del: other reasons-- https://master.php.net/note/delete/95571
Reject -- https://master.php.net/note/reject/95571
Search -- https://master.php.net/manage/user-notes.php