Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Predefined ConstantsGMP Functions>
^GMPLast updated: Mon, 26 Oct 2026

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.


<Predefined ConstantsGMP Functions>
^GMPLast updated: Mon, 26 Oct 2026