fonction abs () de PHP
Exemples
Renvoie la valeur absolue des nombres différents:
<?php
echo(abs(6.7) . "<br>");
echo(abs(-6.7) . "<br>");
echo(abs(-3) . "<br>");
echo(abs(3));
?>
echo(abs(6.7) . "<br>");
echo(abs(-6.7) . "<br>");
echo(abs(-3) . "<br>");
echo(abs(3));
?>
Exécution instance »
Définition et utilisation
fonction abs () renvoie la valeur absolue d'un nombre.
grammaire
abs( number );
参数 | 描述 |
---|---|
number | 必需。规定一个数。如果数字的类型是浮点型,则返回的类型也是浮点型,否则将以整数形式返回。 |
détails techniques
Retours: | nombre de valeur absolue. |
---|---|
Type de retour: | Float / Entier |
PHP version: | 4+ |
PHP Math Reference