Page 1 of 1

Factorial function

Posted: Sat Sep 14, 2002 4:11 am
by ccjob2
Hi,
I need to produce a math job like:
x=n!/6!(n-6)!
that formula contain factorial symbol (!). It's possible to make a factorial function to produce factorial or is there a php function just usefull ?
Thanks
Carlo

Posted: Sat Sep 14, 2002 5:06 am
by Takuma
You probably can make a function yourself...

Code: Select all

<?php
$answer = 1;
$number = 6;
for($i = 1; $i <= $number; $i++) {
  $answer *= $i; 
}
?>