note 21946 deleted from ref.math by cmb
| From: | cmb@php.net | Date: | Sun, 21 Jul 2019 08:55:18 +0000 |
| Subject: | note 21946 deleted from ref.math by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211652@lists.php.net to get a copy of this message | ||
Note Submitter: webkid%webkid.com
----
I found it kind of irritating that PHP had no native functionality for a calculating Factorials.
Since I really didn't feel like loading the GMP library, I figured I'd write my own
function.
function fact($s){$r=(int)$s; for ($i=$r;$i--;$i>1){$r=$r*$i;} return $r;}
I think that's right... I havn't tested it extensively but it should work.