note 120066 added to ref.math
| From: | erikvandeven100 at gmail dot com | Date: | Thu, 20 Oct 2016 12:46:07 +0000 |
| Subject: | note 120066 added to ref.math | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206929@lists.php.net to get a copy of this message | ||
This is my factorial method
<?php
function factorial($nr)
{
$product = array_product(range(1,++$nr));
return $product / $nr;
}
?>
It uses the reversed method by applying division instead of multiplication, so it even returns the
right answer when entering 0.
----
Server IP: 72.52.91.14
Probable Submitter: 217.100.37.18
----
Manual Page -- http://php.net/manual/en/ref.math.php
Edit -- https://master.php.net/note/edit/120066
Del: integrated -- https://master.php.net/note/delete/120066/integrated
Del: useless -- https://master.php.net/note/delete/120066/useless
Del: bad code -- https://master.php.net/note/delete/120066/bad+code
Del: spam -- https://master.php.net/note/delete/120066/spam
Del: non-english -- https://master.php.net/note/delete/120066/non-english
Del: in docs -- https://master.php.net/note/delete/120066/in+docs
Del: other reasons-- https://master.php.net/note/delete/120066
Reject -- https://master.php.net/note/reject/120066
Search -- https://master.php.net/manage/user-notes.php