zerofill un entier php
Comment pourrais-je 'remplir zéro' un entier?
Ie
1 becomes 0001
40 becomes 0040
174 becomes 0174
22
demandé sur
Benjamin
2009-09-18 14:02:17
2 réponses
$number = 12;
$width = 4;
$padded = str_pad((string)$number, $width, "0", STR_PAD_LEFT);
20
répondu
Joe
2009-09-18 10:29:36