Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将如何去“零填充”一个整数?
IE
1 becomes 0001 40 becomes 0040 174 becomes 0174
$filled_int = sprintf("%04d", $your_int)
$number = 12; $width = 4; $padded = str_pad((string)$number, $width, "0", STR_PAD_LEFT);