VOOZH about

URL: https://www.php.net/gmp_add

⇱ PHP: gmp_add - Manual


gmp_and »
« gmp_abs

gmp_add

(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)

gmp_addAdd numbers

Description

function gmp_add(GMP|int|string $num1, GMP|int|string $num2): GMP

Add two numbers.

Parameters

num1
The first summand (augend). A GMP object, an int, or a string that can be interpreted as a number following the same logic as if the string was used in gmp_init() with automatic base detection (i.e. when base is equal to 0).
num2

The second summand (addend).

A GMP object, an int, or a string that can be interpreted as a number following the same logic as if the string was used in gmp_init() with automatic base detection (i.e. when base is equal to 0).

Return Values

A GMP number representing the sum of the arguments.

Examples

Example #1 gmp_add() example

<?php
$sum = gmp_add("123456789012345", "76543210987655");
echo gmp_strval($sum) . "\n";
?>

The above example will output:

200000000000000

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
add a note

User Contributed Notes

There are no user contributed notes for this page.
👁 To Top
and to navigate • to select • to close • to open
Press without selection to search using Google