Le PHP par l'exemple
Recherche sur ce site - Search this website (enter word, expression)
  Traduction - Translate (choose language)
Vous aimez cette page ?
Alors cliquez ici

Partagez, imprimez
mettez en favori...

Accueil Le PHP par l'exemple Utilitaires en ligne Liens Utiles Liens Amis Stats du site Contact

 round 

Voir le Manuel PHP pour round

Description Fonctions mathématiques
round Arrondit un nombre à virgule flottante
Syntaxe round (nombre [, précision [, mode ]])
Précision : nombre de chiffres après la virgule (0 par défaut)
Mode : type d'arrondi (voir manuel et exemples ci-dessous)

Exemple n° 1 : Facile
Exemples d'arrondis
Autres commandes utilisées : echo, for, rand
Voir d'autres exemples utilisant cette fonction

Affichage
Nombres initiaux415.531792.952689.09392.3726.7131.281.25.93.9
round(nombre)416793689922731164
round(nombre, 0)416793689922731164
round(nombre, 1)415.5793689.192.426.731.31.25.93.9
round(nombre, 2)415.53792.95689.0992.3726.7131.281.25.93.9
round(nombre, 3)415.531792.952689.09392.3726.7131.281.25.93.9
round(nombre, 0, PHP_ROUND_HALF_UP)416793689922731164
round(nombre, 1, PHP_ROUND_HALF_UP)415.5793689.192.426.731.31.25.93.9
round(nombre, 2, PHP_ROUND_HALF_UP)415.53792.95689.0992.3726.7131.281.25.93.9
round(nombre, 3, PHP_ROUND_HALF_UP)415.531792.952689.09392.3726.7131.281.25.93.9
round(nombre, 0, PHP_ROUND_HALF_DOWN)416793689922731164
round(nombre, 1, PHP_ROUND_HALF_DOWN)415.5793689.192.426.731.31.25.93.9
round(nombre, 2, PHP_ROUND_HALF_DOWN)415.53792.95689.0992.3726.7131.281.25.93.9
round(nombre, 3, PHP_ROUND_HALF_DOWN)415.531792.952689.09392.3726.7131.281.25.93.9
round(nombre, 0, PHP_ROUND_HALF_EVEN)416793689922731164
round(nombre, 1, PHP_ROUND_HALF_EVEN)415.5793689.192.426.731.31.25.93.9
round(nombre, 2, PHP_ROUND_HALF_EVEN)415.53792.95689.0992.3726.7131.281.25.93.9
round(nombre, 3, PHP_ROUND_HALF_EVEN)415.531792.952689.09392.3726.7131.281.25.93.9
round(nombre, 0, PHP_ROUND_HALF_ODD)416793689922731164
round(nombre, 1, PHP_ROUND_HALF_ODD)415.5793689.192.426.731.31.25.93.9
round(nombre, 2, PHP_ROUND_HALF_ODD)415.53792.95689.0992.3726.7131.281.25.93.9
round(nombre, 3, PHP_ROUND_HALF_ODD)415.531792.952689.09392.3726.7131.281.25.93.9
Code
PHP
Commentaire : les nombres initiaux sont aléatoires, rechargez la page pour les changer
Vous pouvez sélectionner le code ou cliquer sur parenthèses, accolades et crochets pour voir leurs tenant et aboutissant.

top Haut de page