Computer >> Computer tutorials >  >> Programming >> PHP

gmp_add() function in PHP


The gmp_add() function is used to add two GMP numbers.

Syntax

gmp_add ( val1, val2 )

Parameters

  • val1: The first GMP number.

  • val2: The second GMP number.

Return

The gmp_add() function returns the sum of two numbers.

Example

The following is an example that adds two numbers using the gmp_add() function in PHP:

<?php
   $res = gmp_add("39", "80");
   echo gmp_strval($res);
?>

Output

The following is the output:

119