Problem: I have some code that displays
1,2,3,4,5
but I need
01,02,03,04,05
Answer below: –
(the %02d shows 1 zero before, change this to %02d and it will be 001)
1 2 3 4 |
$number = 1; echo $newchain = sprintf('%02d', $number); |
Output 01
Problem: I have some code that displays
1,2,3,4,5
but I need
01,02,03,04,05
Answer below: –
(the %02d shows 1 zero before, change this to %02d and it will be 001)
1 2 3 4 |
$number = 1; echo $newchain = sprintf('%02d', $number); |
Output 01
© 2022 CODEHAVEN