array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.gmp-neg.php', 1 => 'gmp_neg', ), 'up' => array ( 0 => 'ref.gmp.php', 1 => 'GMP 函数', ), 'prev' => array ( 0 => 'function.gmp-mul.php', 1 => 'gmp_mul', ), 'next' => array ( 0 => 'function.gmp-nextprime.php', 1 => 'gmp_nextprime', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/gmp/functions/gmp-neg.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp_neg — Negate number
Returns -num
, as a GMP number.
示例 #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