array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.abs.php', 1 => 'abs', ), 'up' => array ( 0 => 'ref.math.php', 1 => 'Math 函数', ), 'prev' => array ( 0 => 'ref.math.php', 1 => 'Math 函数', ), 'next' => array ( 0 => 'function.acos.php', 1 => 'acos', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/math/functions/abs.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
abs — 绝对值
num
要处理的数字值
版本 | 说明 |
---|---|
8.0.0 |
num 不再接受支持数字转换的内部对象。
|
示例 #1 abs() 示例
<?php
var_dump(abs(-4.2));
var_dump(abs(5));
var_dump(abs(-5));
?>
以上示例会输出:
float(4.2) int(5) int(5)