Combinations nCr Calculator In PHP

Im looking for a simple PHP script / code snippet that can calculate nCr being to calculate the amount of combinations with a 2 sample set

I would like to input a number (stored in variable) and then get an output calculating the total amount of combinations on a 2 sample set. This is the calculation it must follow : C(n,r)=n!(r!(n−r)!)=?

This is a calculator, I would like to be able to do this within PHP (or other web languages), just pass in a number, and receive an output.

I have looked at all the popular common questions, however none provide a efficient in / out approach, I simply want to input a number from a variable say 10 and the output should be 45 based on a 2 sample set.

These are links I have already read all though

PHP array combinations

Php recursion to get all possibilities of strings

Algorithm to return all combinations of k elements from n

Thankyou for any help


Source: stackoverflow-php