Formater un entier en PHP
Résolu
.Zoro.
Messages postés
285
Statut
Membre
-
.Zoro. Messages postés 285 Statut Membre -
.Zoro. Messages postés 285 Statut Membre -
Bonjour,
est-ce que quelqu'un sait comment manipuler les entiers (ou les float aussi)
de maniere a forcer leurs affichage sur 2 chifres
1 => 01
5 => 05
11 => 11
merci
est-ce que quelqu'un sait comment manipuler les entiers (ou les float aussi)
de maniere a forcer leurs affichage sur 2 chifres
1 => 01
5 => 05
11 => 11
merci
2 réponses
-
Regarde ici
https://www.php.net/manual/fr/function.sprintf.php
exemplesjohand@osiris:~/public_html$ cat format.php <?php printf("Entier: %03d\n", 17); printf("Flottant: %08.3f\n", 3.1415926); ?> johand@osiris:~/public_html$ php format.php Entier: 017 Flottant: 0003.142
Gates gave ^H sold you the windows.
GNU gave us the whole house.(Alexandrin) -
merci jisisv
cette fonction correspond a ce que je cherchais