Bcmath

For arbitrary precision mathematics PHP offers BCMath which supports numbers of any size and precision up to 2147483647 (or 0x7FFFFFFF) decimal digits, if there is sufficient memory, represented as strings.

<?php

echo bcpow(3, 40);  // 12157665459056928801
echo 2 ** 40;       // 1.2157665459057E+19 (a float)

?>

Documentation

See also A Comprehensive Guide to the PHP BCMath Library for Arbitrary Precision Arithmetic

Related packages : krowinski/bcmath-extended