PHP
downloads | documentation | faq | getting help | mailing lists | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

<附录
Last updated: Sun, 25 Nov 2007

view this page in

补充说明



add a note add a note User Contributed Notes
补充说明
LXS
17-Oct-2008 06:26
In the Math library, 2 function are missed:

1.) Factorial function
2.) Combines function

1.) CODE:

<?PHP
function factorial ($n) {
    if (
$n == 0) { return 1; }
    return
$n * factorial($n - 1);
}
?>

2.) CODE:

<?PHP
function combinari ($n,$k) {
    if (
0 <= $k && 0 <= $n &&  $k <= $n) {
   
$combinari = factorial ($n) / (factorial ($k) * (factorial ($n - $k)));
    } else {
    print
'Calculul efectuat este imposibil, combinari de N luate cate K ( K mai mic sau egal cu N )!';
    }
    return
$combinari;
}
?>

<附录
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites