phpday 2027 - Call for Papers

Ejemplos

Ejemplo #1 Función factorial usando 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";
?>

Esto va a calcular el factorial de 1000 (Un bonito gran número) muy rápido.

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top