PHP - gmp_neg() Function
Definition and Usage
The gmp_neg() function returns the negative value of the given number.
Description
The gmp_neg() function returns a negative GMP number.
Syntax
gmp_neg ( GMP $a ) : GMP
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
a It can a GMP resource number , a gmp object or a numeric string. |
Return Values
PHP gmp_neg() function returns negative GMP number.
PHP Version
This function will work from PHP Version greater than 5.0.0.
Example 1
Working of gmp_neg −
<?php
$num = gmp_neg("3423");
echo "The result is : ".$num;
?>
This will produce following result −
The result is : -3423
Example 2
Working of gmp_neg −
<?php
$num = gmp_neg("0xFE");
echo "The result is : ".$num;
?>
This will produce following result −
The result is : -254
php_function_reference.htm
Advertisements