freddiefujiwara freddiefujiwara - 3 months ago 9
PHP Question

Is there a BigInteger class in PHP?

Is there a BigInteger class in PHP? If so, how do I access it or use it?

Answer

Hopefully helpfull links :

EDIT: Math_BigInteger

Example from http://phpseclib.sourceforge.net/documentation/math.html :

Implements an arbitrary precision integer arithmetic library. Uses gmp or bcmath, if available, and an internal implementation, otherwise.

<?php
    include('Math/BigInteger.php');

    $a = new Math_BigInteger(2);
    $b = new Math_BigInteger(3);

    $c = $a->add($b);

    echo $c->toString(); // outputs 5
?>