Consider my variable $result to be 01212…. Now if i add 1 to my variable i get the answer 1213,but i want it to be 01213…. My php code is
echo sprintf('%02u', ($result+1));
Edit:
Answers to this question works.. But what happens if my variable is $result to be 0121212
in future…
You can use
%05uinstead on%02uEDIT:
To generalize it: