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

gmp_abs() function in PHP


The gmp_abs() function computes the absolute value of a GMP number.

Syntax

gmp_abs(val)

Parameters

  • val: The GMP number for which we want the absolute value.

Return

The gmp_abs() function returns the absolute value of val parameter.

Example

The following is an example:

<?php
   $a = gmp_abs("-90087");
   echo gmp_strval($a);
?>

Output

The following is the output:

90087