From the source:

Cumulative Distribution Function

BINomial distribution

Function

Calculates any one parameter of the binomial

distribution given values for the others.

Arguments

WHICH --> Integer indicating which of the next four argument

values is to be calculated from the others.

Legal range: 1..4

iwhich = 1 : Calculate P and Q from S,XN,PR and OMPR

iwhich = 2 : Calculate S from P,Q,XN,PR and OMPR

iwhich = 3 : Calculate XN from P,Q,S,PR and OMPR

iwhich = 4 : Calculate PR and OMPR from P,Q,S and XN

P <--> The cumulation from 0 to S of the binomial distribution.

(Probablility of S or fewer successes in XN trials each

with probability of success PR.)

Input range: [0,1].

Q <--> 1-P.

Input range: [0, 1].

P + Q = 1.0.

S <--> The number of successes observed.

Input range: [0, XN]

Search range: [0, XN]

XN <--> The number of binomial trials.

Input range: (0, +infinity).

Search range: [1E-100, 1E100]

PR <--> The probability of success in each binomial trial.

Input range: [0,1].

Search range: [0,1]

OMPR <--> 1-PR

Input range: [0,1].

Search range: [0,1]

PR + OMPR = 1.0

STATUS <-- 0 if calculation completed correctly

-I if input parameter number I is out of range

1 if answer appears to be lower than lowest

search bound

2 if answer appears to be higher than greatest

search bound

3 if P + Q .ne. 1

4 if PR + OMPR .ne. 1

BOUND <-- Undefined if STATUS is 0

Bound exceeded by parameter number I if STATUS

is negative.

Lower search bound if STATUS is 1.

And here what the parameters mean depending on the which:

if (which < 4) {

pr = arg3;

ompr = 1.0 - pr;

} else {

xn = arg3;

}

if (which < 3) {

xn = arg2;

} else {

sn = arg2;

}

if (which == 1) {

sn = arg1;

} else {

p = arg1;

q = 1.0 - p;

}

For large number to use in php use the http://www.php.net/bc extenion

Cumulative Distribution Function

BINomial distribution

Function

Calculates any one parameter of the binomial

distribution given values for the others.

Arguments

WHICH --> Integer indicating which of the next four argument

values is to be calculated from the others.

Legal range: 1..4

iwhich = 1 : Calculate P and Q from S,XN,PR and OMPR

iwhich = 2 : Calculate S from P,Q,XN,PR and OMPR

iwhich = 3 : Calculate XN from P,Q,S,PR and OMPR

iwhich = 4 : Calculate PR and OMPR from P,Q,S and XN

P <--> The cumulation from 0 to S of the binomial distribution.

(Probablility of S or fewer successes in XN trials each

with probability of success PR.)

Input range: [0,1].

Q <--> 1-P.

Input range: [0, 1].

P + Q = 1.0.

S <--> The number of successes observed.

Input range: [0, XN]

Search range: [0, XN]

XN <--> The number of binomial trials.

Input range: (0, +infinity).

Search range: [1E-100, 1E100]

PR <--> The probability of success in each binomial trial.

Input range: [0,1].

Search range: [0,1]

OMPR <--> 1-PR

Input range: [0,1].

Search range: [0,1]

PR + OMPR = 1.0

STATUS <-- 0 if calculation completed correctly

-I if input parameter number I is out of range

1 if answer appears to be lower than lowest

search bound

2 if answer appears to be higher than greatest

search bound

3 if P + Q .ne. 1

4 if PR + OMPR .ne. 1

BOUND <-- Undefined if STATUS is 0

Bound exceeded by parameter number I if STATUS

is negative.

Lower search bound if STATUS is 1.

And here what the parameters mean depending on the which:

if (which < 4) {

pr = arg3;

ompr = 1.0 - pr;

} else {

xn = arg3;

}

if (which < 3) {

xn = arg2;

} else {

sn = arg2;

}

if (which == 1) {

sn = arg1;

} else {

p = arg1;

q = 1.0 - p;

}

For large number to use in php use the http://www.php.net/bc extenion