php8.5
Home/ Manual/ gmp / functions/ gmp_add

gmp_add

PHP function Edit on GitHub ✎

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

Add numbers

Description

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

Add two numbers.

Parameters

num1

The first summand (augend).

Parameter

num2

The second summand (addend).

Parameter

Return Values

A GMP number representing the sum of the arguments.

Examples

gmp_add() example

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

The above example will output:

output
200000000000000

Source: reference/gmp/functions/gmp-add.xml · from the official PHP manual (php/doc-en)