gmp_neg

(PHP 4 >= 4.0.4, PHP 5)

gmp_negNegate number

說明

GMP gmp_neg ( GMP $a )

Returns the negative value of a number.

參數

a

可以是一個 GMP 數據 resouce,或一個可以轉換為數值的字串。

回傳值

Returns -a, as a GMP number.

範例

Example #1 gmp_neg() example

<?php
$neg1 
gmp_neg("1");
echo 
gmp_strval($neg1) . "\n";
$neg2 gmp_neg("-1");
echo 
gmp_strval($neg2) . "\n";
?>

上例將輸出:

-1
1

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top