ConFoo: Call for paper is now Open

Examples

Example #1 Factorial function using GMP

<?php
function fact($x
{
    
$return 1;
    for (
$i=2$i <= $x$i++) {
        
$return gmp_mul($return$i);
    }
    return 
$return;
}

echo 
gmp_strval(fact(1000)) . "\n";
?>

This will calculate factorial of 1000 (pretty big number) very fast.

add a note add a note

User Contributed Notes 1 note

up
2
Jonathon
7 months ago
Of course, this example is pointless because there is gmp_fact().
To Top