Here is my code:
<?php $variable1 = 00001; $variable2 = (sprintf('%04d', $variable1 + 1)); echo $variable2; ?>
How come the outcome of this code is ‘0002’ and not ‘00002’? in other words it is missing a 0.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The 4 in %04d sets the total width of the printed value