Recherche sur les Noms des fonctions php/mysql
abs()
Définition
Valeur absolue - (PHP 4, PHP 5)Description
Retourne la valeur absolue du nombre number .
Liste de paramètres
- number
-
La valeur numérique à traiter
Valeurs de retour
La valeur absolue du nombre number . Si le nombre est un nombre à virgule flottante (float), le type retourné est aussi un nombre à virgule flottante (float), sinon, c'est un entier (entier).
Exemples
Exemple #1 Exemple avec abs()
<?php
$abs = abs(-4.2); // $abs = 4.2; (double/float)
$abs2 = abs(5); // $abs2 = 5; (integer)
$abs3 = abs(-5); // $abs3 = 5; (integer)
?>
Bouts de code utilisant la fonction abs()
<?php /* ... */
return 'Il reste <strong>'.ceil($calcul).' minute'.AuPluriel($calcul).'</strong>.';
} elseif($diff<0 && abs($diff)<3600) {
// DEPUIS EN MINUTES
/* ... */ ?>
<?php /* ... */
$t_annee = $a_annee - $v_annee;
$resultat = '<p>'.abs($t_annee).' ans '.abs($t_mois).' mois et '.abs($t_jours).' jours depuis aujourd\'hui.</p>';
}
/* ... */ ?>
<?php /* ... */
$total = ($SecondeA - $SecondeB) + ($uSecondeA - $uSecondeB);
return number_format(abs($total),16);
}
/* ... */ ?>
Connexion
Les fonctions
Références
- abs
- acos
- acosh
- asin
- asinh
- atan2
- atan
- atanh
- base_convert
- bindec
- ceil
- cos
- cosh
- decbin
- dechex
- decoct
- deg2rad
- exp
- expm1
- floor
- fmod
- getrandmax
- hexdec
- hypot
- is_finite
- is_infinite
- is_nan
- lcg_value
- log10
- log1p
- log
- max
- min
- mt_getrandmax
- mt_rand
- mt_srand
- octdec
- pi
- pow
- rad2deg
- rand
- round
- sin
- sinh
- sqrt
- srand
- tan
- tanh





